Preprocessor Trickery

John P. Linderman jpl at allegra.UUCP
Fri Jun 29 21:18:10 AEST 1984


I expected to see a hail of responses to this item, but since a few
days have gone by, and the only response has been in support of X/**/y,
the following ought to see the light of day:

#define QUOTE(X) X
#define MAKENAME(Y) QUOTE(X)Y
#define CAT(X,Y) QUOTE(X)Y

MAKENAME(lax)
CAT(X,pertsystems)

As long as macros are supported, this mechanism will work; no tricky
stuff.  To give credit where it is due, I think I first saw the
QUOTE macro used by Mike Bianchi, for quite different reasons.
It's a useful addition to one's bag of tricks.

John P. Linderman  Department of Macro Biology  allegra!jpl



More information about the Comp.lang.c mailing list