Preprocessor Trickery
ado at elsie.UUCP
ado at elsie.UUCP
Thu Jul 12 00:48:15 AEST 1984
> For concatenating strings at preprocessor time, try this:
>
> #define Ident(xxx) xxx
>
> #define concat(a,b) Ident(a)b
>
> It should always work. . .
"Always"? How about if either "a" or "b" is "__LINE__"?
Try typing this to see what happens:
cc -E -
#define Ident(xxx) xxx
#define concat(a,b) Ident(a)b
__LINE__
concat(__LINE__,__LINE__)
--
...decvax!allegra!umcp-cs!elsie!ado (301) 496-5688
(the DEC and VAX in decvax are Digital Equipment Corporation trademarks)
More information about the Comp.lang.c
mailing list