#define CTRL(x) followup (it can't be done in ANSI C)
John Gilmore
gnu at hoptoad.uucp
Tue Dec 2 14:33:13 AEST 1986
In article <103 at decvax.UUCP>, minow at decvax.UUCP (Martin Minow) writes:
> As I understand the spec, Reiser constructions map into ANSI C as follows:
>
> Reiser ANSI
> token pasting: #define foo(a,b) a/**/b a##b
> string repl.: #define foo(a) "xxx a yyy" "xxx #a yyy"
> char repl.: #define foo(a) 'a' Not provided to my knowledge.
I believe this is wrong. Try:
string repl.: #define foo(a) "xxx a yyy" "xxx " #a " yyy"
There is still no way to do character replacement as in the Reiser CPP.
Some people have suggested
char repl.: #define foo(a) 'a' (#a)[0]
but this is not a constant expression (as defined in section 3.4 of the
dpANS) so it cannot be used e.g. in a case label. There was a kludge posted
that defined 52 new #define's (__a, __A, __b, __B, etc) but this is horrid
and does not support things like CTRL([).
It seems to me that the standards committee should support subscripting of
constant expressions (e.g. "["[0]) in constant expressions; that would
lay this issue to rest, finally.
--
John Gilmore {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu jgilmore at lll-crg.arpa
"I can't think of a better way for the War Dept to spend money than to
subsidize the education of teenage system hackers by creating the Arpanet."
More information about the Comp.lang.c
mailing list