INT_MAX definition in gmp-impl.h conflicts with limits.h

Vincent Lefevre vincent at vinc17.net
Wed Nov 23 17:05:54 CET 2011


On 2011-11-23 15:35:33 +0100, Marc Glisse wrote:
> Ah. Maybe including limits.h in gmp-impl.h before defining INTMAX and such?

AFAIK, redefining standard macros when the corresponding header
(here <limits.h>) has been including is not allowed by the C standard.
So, problems might appear...

I think the real fix would be not to reuse the standard macro names.
For instance, GMP could define GMP_INTMAX and so on for its own use.

> It is already done for CRAY, I could make it be included also in C++/glibc
> when the #include <string> defined some macro characteristic of libc++.
> 
> Actually, tests.h already includes config.h. If there is a dependency
> between tests.h and gmp-impl.h, we should probably include one in the other,
> but config.h is not such a dependency.

Ah, OK, I didn't see this.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list