This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Preprocessor question...
- To: Glen Nakamura <gen at lava dot net>
- Subject: Re: Preprocessor question...
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Fri, 16 Feb 2001 00:58:34 +0000 (GMT)
- cc: <gcc-bugs at gcc dot gnu dot org>
On Thu, 15 Feb 2001, Glen Nakamura wrote:
> My guess is the preprocessor thinks "0x0E+" is a floating point constant?
> Anyway, the code also works if I use a different hex digit:
> e.g. #define NUMBER (0x0A+OFFSET)
You have read the GCC manual (Bugs / Known / Incompatibilities)?
* GNU C complains about program fragments such as `0x74ae-0x4000'
which appear to be two hexadecimal constants separated by the minus
operator. Actually, this string is a single "preprocessing token".
Each such token must correspond to one token in C. Since this
does not, GNU C prints an error message. Although it may appear
obvious that what is meant is an operator and two values, the ISO
C standard specifically requires that this be treated as erroneous.
A "preprocessing token" is a "preprocessing number" if it begins
with a digit and is followed by letters, underscores, digits,
periods and `e+', `e-', `E+', `E-', `p+', `p-', `P+', or `P-'
character sequences. (In strict C89 mode, the sequences `p+',
`p-', `P+' and `P-' cannot appear in preprocessing numbers.)
To make the above program fragment valid, place whitespace in
front of the minus sign. This whitespace will end the
preprocessing number.
If you didn't find this in the manual, could you let us know how we might
improve the manual so that it would have been easier to find this
information?
--
Joseph S. Myers
jsm28@cam.ac.uk