Preprocessor Trickery

Bill Mitchell whm at arizona.UUCP
Tue Jun 26 15:25:14 AEST 1984


I need a way to form variable names using cpp macros.  For example, I'd
like a macro X(y), which might expand X(foo) into Xfoo.  It so happens
that

	#define X(y) X/**/y
	X(foo)

works on 4.xbsd and on V7.  This apparently because cpp considers
	int z/**/z;
to be
	int zz;

Is there some proper way to achieve the same effect without relying on
this "feature" of cpp and thus retain some hope of portability?

					Thanks,
					Bill Mitchell
					whm.arizona at csnet-relay
					{noao,mcnc,utah-cs}!arizona!whm



More information about the Comp.lang.c mailing list