Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!princeton!allegra!ulysses!mhuxt!ihnp4!houxm!mtuxo!mtune!akgua!emory!arnold From: arnold@emory.UUCP Newsgroups: comp.lang.c Subject: Re: Why all this fuss about CTRL(X) ?? Message-ID: <1971@emory.UUCP> Date: Tue, 23-Dec-86 13:05:45 EST Article-I.D.: emory.1971 Posted: Tue Dec 23 13:05:45 1986 Date-Received: Fri, 26-Dec-86 02:36:18 EST References: <1955@watdragon.UUCP> <184@devon.UUCP> <1581@ihlpl.UUCP> Reply-To: arnold@emory.UUCP (Arnold D. Robbins {EUCC}) Organization: Math & Computer Science, Emory University, Atlanta Lines: 28 I hope somebody hasn't beat me to this. The whole fuss about #define CTRL(X) ('X' & 037) /* ascii! */ in the Reiser cpp not being doable in ANSI C can be answered this way: #define CTRL(X) (' ## X ## ' & 037) /* ascii only */ which uses the token concatenation operator to produce the character constant. This should also work for things like esc = CTRL([); I am sure someone will correct me if I am wrong. Now, we can hopefully put this to rest! ( Personally, I think CTRL(X) is bad style; #define ctrl(x) ((x) & 037) and using ctrl('x') makes the most sense to me. It is legal in both K&R C and ANSI C, and allows using the macro on a char or int variable, not just on a constant. So there. :-) -- Arnold Robbins CSNET: arnold@emory BITNET: arnold@emoryu1 ARPA: arnold%emory.csnet@csnet-relay.arpa UUCP: { akgua, decvax, gatech, sb1, sb6, sunatl }!emory!arnold