H
Henry Townsend
I hope this is on-topic in c.l.c - it's about the C preprocessor more
than the language per se, more generally about the K&R behavior, and
most specifically about the Sun cpp which is why I've cross posted there.
The test case below is taken from an Imake setup (yes, old, I know).
There's a Concat() macro which uses old-style /**/ for token pasting (we
are not allowed to assume ANSI so ## isn't allowed). I'm trying to paste
AND expand the two macros X and Y. I cannot figure out why it doesn't
work in this scenario; the literal /**/ works but the macro doesn't.
% cat /tmp/X.c
#define X xxx
#define Y yyy
#define Concat(a,b)a/**/b
X/**/Y
Concat(X,Y)
% /usr/ccs/lib/cpp /tmp/X.c
# 1 "/tmp/X.c"
[blank space elided]
xxxyyy
XY
Thanks,
HT
than the language per se, more generally about the K&R behavior, and
most specifically about the Sun cpp which is why I've cross posted there.
The test case below is taken from an Imake setup (yes, old, I know).
There's a Concat() macro which uses old-style /**/ for token pasting (we
are not allowed to assume ANSI so ## isn't allowed). I'm trying to paste
AND expand the two macros X and Y. I cannot figure out why it doesn't
work in this scenario; the literal /**/ works but the macro doesn't.
% cat /tmp/X.c
#define X xxx
#define Y yyy
#define Concat(a,b)a/**/b
X/**/Y
Concat(X,Y)
% /usr/ccs/lib/cpp /tmp/X.c
# 1 "/tmp/X.c"
[blank space elided]
xxxyyy
XY
Thanks,
HT