Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!greg From: greg@utcsri.UUCP (Gregory Smith) Newsgroups: comp.lang.c Subject: Re: #define CTRL(x) followup (it can't be done in ANSI C) Message-ID: <3721@utcsri.UUCP> Date: Wed, 3-Dec-86 17:19:15 EST Article-I.D.: utcsri.3721 Posted: Wed Dec 3 17:19:15 1986 Date-Received: Wed, 3-Dec-86 17:40:56 EST References: <7136@elsie.UUCP> <779@valid.UUCP> <5396@brl-smoke.ARPA> <103@decvax.UUCP> <1375@hoptoad.uucp> Reply-To: greg@utcsri.UUCP (Gregory Smith) Organization: CSRI, University of Toronto Lines: 31 Summary: ENOUGH ALREADY!!!!! In article <1375@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes: >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. ... and generates superfluous code wherever it *is* used. >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. Is it that hard to write CTRL('X') rather than CTRL(X), that you want to add a somewhat bizarre, difficult-to-support feature to a language that already has more than its fair share of weird? "string"[2] is supposed to mean *("string"+2), and the * operator obviously cannot be allowed in constant expressions in general. So do you want to (a) allow * to be applied to expressions which are addresses of bytes known to be within constant strings (which do not necessarily exist at run-time!) or (b) allow "string"[constant] (with the obvious restriction on constant) and make a[b] differ from *(a+b) in this Yet Another Special Case? Obviously (a) is silly, and (b) *could* be done, but you get my point. If you have lots of code with CTRL([) etc, in it, why not write a lex script to change it to the way it should have been written in the first place? -- ---------------------------------------------------------------------- Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg Have vAX, will hack...