Bug (?) in C preprocessor

boyd at basser.UUCP boyd at basser.UUCP
Wed May 30 04:52:32 AEST 1984


No.  The reference manual states:

	"Each occurrance of an identifier mentioned in the
	formal parameter list of the definition is replaced
	by the corresponding token string from the call."

	"...the replacement string is rescanned for more
	defined identifiers."

	"Text inside a string or character constant is not
	subject to replacement."

Hence:

#define quote(x)	"x"
#define gooeys		sooterkin

quote(gooeys) expands to "gooeys" and not "sooterkin".

I have written a C preprocessor that adheres to the most
recent standard.  The standard has these "additions":

	#elif expression
and
	defined(name) in #if expressions

I wouldn't advise a change to the preproccessor to do this alternate
expansion because by definition it would NOT be the C preproccessor.


---
>From the VB can of Boyd Roberts.	...!decvax!mulga!boyd:basser



More information about the Net.bugs mailing list