Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ucsfcgl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ucbvax!ucsfcgl!arnold From: arnold@ucsfcgl.UUCP (Ken Arnold%CGL) Newsgroups: net.lang.c Subject: Re: CTRL(X) in ANSI standard (last one I hope) Message-ID: <507@ucsfcgl.UUCP> Date: Tue, 21-May-85 20:30:46 EDT Article-I.D.: ucsfcgl.507 Posted: Tue May 21 20:30:46 1985 Date-Received: Fri, 24-May-85 03:55:04 EDT References: <10747@brl-tgr.ARPA> Reply-To: arnold@ucsfcgl.UUCP (PUT YOUR NAME HERE) Organization: UCSF Computer Graphics Lab Lines: 29 In article <10747@brl-tgr.ARPA> Purtill@MIT-MULTICS.ARPA (Mark Purtill) writes: >I'm suprised no one caught me on this. When I said >>#define CTRL(XX) ( ($XX)[0] & '\037') >I should have said >>#define CTRL(XX) ( (#XX)[0] & '\037') >(ie, the $ should have been a #!!) Sorry about that... Unless the compiler is incredibly smart, this won't work in 'case' statements, which is rather important. Although "a"[0] is, in fact, a constant, it is only a constant because it is a constant offset into a *constant array*, which is a rather unusual beast. The VAX pcc doesn't figure this out. Try this on your compiler and see if it does: switch (i) { case "a"[0]: break; } Actually, when you think about it, since strings are writeable, "a"[0] is NOT a constant, since someone else might modify the string. It is an indirection off of a constant location, but it is not a constant. Face it. We are going to have to kill ourselves trying to work around the standard committee's refusal to let C work the way it has been working. I have made my opinion on this known ad nauseum, I'm sure, so I'll just leave it alone for now... Ken Arnold