Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!hoptoad!gnu From: gnu@hoptoad.uucp (John Gilmore) Newsgroups: comp.lang.c Subject: Re: #define CTRL(x) followup (it can't be done in ANSI C) Message-ID: <1375@hoptoad.uucp> Date: Mon, 1-Dec-86 23:33:13 EST Article-I.D.: hoptoad.1375 Posted: Mon Dec 1 23:33:13 1986 Date-Received: Tue, 2-Dec-86 03:14:19 EST References: <7136@elsie.UUCP> <779@valid.UUCP> <5396@brl-smoke.ARPA> <103@decvax.UUCP> Organization: Nebula Consultants in San Francisco Lines: 27 In article <103@decvax.UUCP>, minow@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@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."