Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.lang.c Subject: Re: Redefining keywords (is #define short int legal?) Message-ID: <4985@utzoo.UUCP> Date: Tue, 29-Jan-85 18:57:19 EST Article-I.D.: utzoo.4985 Posted: Tue Jan 29 18:57:19 1985 Date-Received: Tue, 29-Jan-85 18:57:19 EST References: <321@desint.UUCP> Organization: U of Toronto Zoology Lines: 19 > ... Is it legal (by the ANSI standard) > to treat C keywords specially *in the 'preprocessor'*? (I quote > 'preprocessor' because I don't think the standard actually requires it to be > a separate pass.) An interesting question. By a slightly-old draft (my copy of the latest one isn't handy right now), it would seem that C keywords are, indeed, not identifiers and thus are ineligible for being #defined. I don't know whether this is a feature or an oversight, although I would suspect the former. One reason for suspecting it is that the committee was trying to define the preprocessor commands in such a way that implementation at the token (as opposed to text-stream) level was straightforward. The reason for this is the one you allude to: the preprocessor is not required to be a separate pass, and in fact a number of compilers do it in the scanner. Life is much simpler if preprocessing doesn't require mapping tokens back to a string representation. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry