0x47e+barney not considered C
Henry Spencer
henry at utzoo.uucp
Fri Jul 8 13:58:25 AEST 1988
> Without deep consideration I can't see why preprocessing numbers can't just
> be assigned the same syntax as ordinary numbers...
Well, speaking as someone who has implemented a C lexical analyzer, I was
very happy when preprocessing numbers arrived. Without them, you have to
implement lexical analysis of C numbers -- which are a baroque mess --
*twice*. Why? Because a lot of validity checks that are needed for real,
live numbers cannot be applied to preprocessing numbers, since abominations
like the # and ## operators may alter the tokens before the preprocessor
is finished with them. Short of storing numbers in some complex broken-
down form -- and remember that those same two operators require that the
original text be recoverable! -- there is just no way to avoid repeating
the whole ugly lexical analysis when you've got the final tokens on hand.
Personally, my favorite solution to this involves eliminating the # and
## operators, by saturation thermonuclear bombing if nothing less will
kill them, but not everyone likes this idea.
More information about the Comp.std.c
mailing list