Concatenating tokens that aren't parameters, in ANSI C
~XT4103000~Marc Mengel~C25~G25~6184~
mmengel at cuuxb.ATT.COM
Thu Jul 28 00:54:36 AEST 1988
In article <4963 at hoptoad.uucp> gnu at hoptoad.uucp (John Gilmore) writes:
[old code breaks under ANSI cpp follows]
>#define LFD 6
>#define LHIGH 1.0e+LFD
>which expanded to
>1.0e+6
[tried]
>#define LHIGH 1.0e+ ## LFD
[and also]
>#define cat_a(a,b) a ## b
>#define cat_b(a,b) a ## b
>#define LHIGH cat_a(1.0e+,cat_b(LFD,))
>
>should work, but it produces:
>
>1.0e+cat_b(6 ,)
Hmmm. seeems like maybe
#define LFD 6
#define BASE 1.0e
#define LHIGH LFD+BASE
might just work, I don't have a gcc cpp handy to test it though. (It
works under SysV cc.
>John Gilmore {sun,pacbell,uunet,pyramid,amdahl}!hoptoad!gnu gnu at toad.com
--
Marc Mengel
attmail!mmengel
{lll-crg|mtune|ihnp4}!cuuxb!mmengel
More information about the Comp.std.c
mailing list