Newsgroups: comp.std.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: 0x47e+barney not considered C
Message-ID: <1988Jul8.035825.17546@utzoo.uucp>
Organization: U of Toronto Zoology
References: <120200001@hcx2> <10413@ulysses.homer.nj.att.com>
Date: Fri, 8 Jul 88 03:58:25 GMT

> 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.