This is the mail archive of the
mailing list for the GCC project.
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Preprocessor question...
- From: Glen Nakamura <gen at lava dot net>
- Date: Thu, 15 Feb 2001 13:37:51 -1000
Is the following valid code?
#define OFFSET (0x1000)
#define NUMBER (0x0E+OFFSET)
I get the following error when compiling with egcs-1.1.2 or gcc-2.95.2:
test.c: In function `main':
test.c:8: missing white space after number `0x0E'
test.c:8: `OFFSET' undeclared (first use in this function)
test.c:8: (Each undeclared identifier is reported only once
test.c:8: for each function it appears in.)
The code works if I put spaces around the "+":
e.g. #define NUMBER (0x0E + OFFSET)
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)
Not really a big deal, I'm just curious...
Anyone have an explanation?
- Glen Nakamura