Forming composite tokens using / - (nf)

jim at ism780.UUCP jim at ism780.UUCP
Fri May 11 14:02:43 AEST 1984


#R:randvax:-178200:ism780:12500005:000:597
ism780!jim    May 10 10:32:00 1984

> Another alternative (which is probably equally offensive):
>    |
>    |#define cat(a,b) a\
>    |b
>    |
> At least this doesn't rely on the preprocessor stripping comments.
> But it is still likely to be non-portable.

Due to typical AT&T brain damage, this does not work in System V, where
the backslash-newline is turned into a space (idiots!).

A method guaranteed to work anywhere is

#define IDENT(x)x
#define CAT(a,b)IDENT(a)b

Be sure that you use CAT(x,y) instead of, e.g., CAT(x, y), since the white
space is part of the macro argument.

-- Jim Balter, Interactive Systems (ima!jim)



More information about the Comp.lang.c mailing list