draft ANSI standard: Is a quote a valid preprocessor-token?

Dave Decot decot at hpisod2.HP
Sun Jan 11 20:40:15 AEST 1987


> In article <1971 at emory.UUCP>, arnold at emory.UUCP writes:
> > #define CTRL(X)	(' ## X ## ' & 037)	/* ascii only */
> >    ...uses the token concatenation operator to produce the character
> > constant....
> > I am sure someone will correct me if I am wrong.
> 
> 	preprocessing-token:
> 		header-name	 (only within a #include directive)
> 		identifier
> 		constant
> 		string-literal
> 		operator
> 		punctuator
> 		each non-white-space character that cannot be one of the above
> 
> Aha!  Since a lone quote is not any of the above, it must be one of those
> "each non white space characters", and it must be a preprocessing-token.
> Right?

' ## X ## ' comes under the heading of "constant".

> Phooey.  There should be specific instructions in the standard on
> lexical analysis of C programs, e.g. an algorithm for parsing, rather
> than this vague English rubbish.

I agree.  It is possible to accurately describe anything in English.
It is not always possible to accurately describe things in vague English.

Dave Decot
hpda!decot



More information about the Comp.lang.c mailing list