Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site cornell.UUCP
Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!vax135!cornell!jqj
From: jqj@cornell.UUCP (J Q Johnson)
Newsgroups: net.unix-wizards
Subject: Re: Is this correct action for the c compiler/preprocessor ??
Message-ID: <270@cornell.UUCP>
Date: Thu, 31-Oct-85 06:14:15 EST
Article-I.D.: cornell.270
Posted: Thu Oct 31 06:14:15 1985
Date-Received: Sat, 2-Nov-85 04:31:12 EST
References: <8510301207.AA27158@ucbvax.berkeley.edu>
Reply-To: jqj@cornell.UUCP (J Q Johnson)
Organization: Cornell Univ. CS Dept.
Lines: 20

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.  However, some compilers, notably Tartan C, behave differently,
and expand the above example without substituting the ``a''.

A related issue is handling of comments in the preprocessor.  cpp permits
	#define makesym(a)	foo/**/a
which expands ``makesym(X)'' to ``fooX'' (unless, of course, -C is specified
in which case the comment is retained).  Other compilers might legitimately
strip the comments before parsing the macro definition, and thus might not
see the ``a'' in the definition as a separate token to be substituted, or
might substitute white space for the /**/, resulting in an expansion to 
``foo X''.