preprocessor/5806: The preprocessor evaluates expression s in 64-bit, violating IS C++ 16.1.4
neil@gcc.gnu.org
neil@gcc.gnu.org
Mon May 27 12:22:00 GMT 2002
Synopsis: The preprocessor evaluates expression s in 64-bit, violating IS C++ 16.1.4
State-Changed-From-To: analyzed->closed
State-Changed-By: neil
State-Changed-When: Mon May 27 12:22:20 2002
State-Changed-Why:
After some recent patches of mine, GCC 3.2 does preprocessor arithmetic to the precision of the target's intmax_t, as required by the C99 standard.
As you can see from a discussion in the last two days on GCC-patches mailing list, it was decided that we should do this in C89 mode as well, otherwise there is no consistent way for us to have the long-long extension.
Now, you claim it violates the ISO C++ and C89 standards. In fact it does not; if you read the relevant section carefully, it says that CPP arithmetic is done to *at least* the precision of the target "long" type. By using intmax_t, we are in compliance with this requirement:
"... the controlling constant expression ... is evaluated according to the rules of 6.4 using arithmetic that has *at least* the ranges specified in 5.2.4.2, except that int and unsigned int act as if they have the same representation as, respectively, long and unsigned long."
Because of this wording, any code that relied on the C89 preprocessor to determine properties of the target machine precision was always broken.
Thanks for the bug report.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5806
More information about the Gcc-bugs
mailing list