Q: There is a severe bug in GCC: it says "garbage at end of
number" for this line:
i = 0xfe+0x20;
Ain't it silly that such a great compiler would fail so miserably?
A: That's not a bug, that's a feature of the ANSI C language
definition. By ANSI rules, the above expression is a single
preprocessing token, unless you place whitespace in front of the
plus sign. The reason for this seemingly counterintuitive feature is
the syntax of floating-point constants in which letters `e' and `E'
followed immediately by a sign signal a decimal exponent. You can use
-traditional compiler switch to turn this feature off
(however, it will also turn off a plethora of other ANSI features; see
the GCC docs for details).
Judging by the published draft, this is unchanged even in the forthcoming C9X standard.
|webmaster||delorie software privacy|
|Copyright © 2001 by Eli Zaretskii||Updated Apr 2001|