Is this correct action for the c compiler/preprocessor ??

Dick Dunn rcd at opus.UUCP
Mon Nov 4 18:02:23 AEST 1985


> Most versions of pcc ignore stringness (``"'') when looking for tokens 
> for macro replacement.  Thus
> 	#define foo(a)	"This string contains a"
> expands the call ``foo(X)'' to
> 	"This string contains X"
> 
> K&R are silent on the lexical issues involved, so this cannot be considered
> incorrect...

Foo.  Come on, folks!  The relevant section of K&R is easy enough to
find--it's called "Token Replacement".  It's only half a page long and not
that hard to read.  Read along with me...

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

Get it?
-- 
Dick Dunn	{hao,ucbvax,allegra}!nbires!rcd		(303)444-5710 x3086
   ...Never attribute to malice what can be adequately explained by stupidity.



More information about the Comp.unix.wizards mailing list