[comp.lang.c] String Constant Concatenation in MPW

desnoyer@Apple.COM (Peter Desnoyers) (01/28/89)

I don't seem to be able to concatenate string constants when they
are defined as macros - i.e. the following code

#define XXX "aaaaa"
	printf( "I    " "aaaaa" );	/* no macro */
	printf( "I    " XXX );		/* macro */

results in the following error:
#	printf( "I    " "aaaaa" );	/* macro */
#	                       ?  		            
### Error 24 ')' expected 
[... other messages ]

The code compiles properly when "aaaaa" is used, but not when I use
the macro for "aaaaa". 

Am I really not allowed to do this in ANSI C? Or is this a
bug in the MPW C compiler?

				Peter Desnoyers

gwyn@smoke.BRL.MIL (Doug Gwyn ) (01/28/89)

In article <24885@apple.Apple.COM> desnoyer@Apple.COM (Peter Desnoyers) writes:
>Am I really not allowed to do this in ANSI C? Or is this a
>bug in the MPW C compiler?

Sounds like a bug to me.  Concatenation of adjacent string literals
is supposed to conceptually occur after all preprocessing is complete.
(Concatenation is in translation phase 6, preprocessing is phase 4.)