Including <limits.h> in gmp-impl.h
vincent at vinc17.net
Wed Dec 25 12:04:07 UTC 2013
On 2013-12-25 12:13:39 +0100, Marc Glisse wrote:
> Oups, looks like I already asked about that:
> and the reply was to try including tests.h before gmp-impl.h.
I'd say that it would be better to fix GMP. Reusing standard macros
(even when there are not supposed to be defined under some conditions)
is ugly. For instance, GMP_INT_MAX could be used instead of INT_MAX,
and there would be no risk of clashes.
Including tests.h before gmp-impl.h is probably not a good solution
because in such tests, <limits.h> (from tests.h) may be used instead
of GMP's definitions. So, if don't trust <limits.h>, that's incorrect.
I'd also say that if <limits.h> is incorrect, lots of programs will
fail to build correctly. So, GMP's trick to redefine limits will be
useful only for users who use GMP in their own applications, without
using <limits.h> in their applications either.
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 / AriC project (LIP, ENS-Lyon)
More information about the gmp-devel