Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.lang.c Subject: CTRL(x) revisited Message-ID: <7212@elsie.UUCP> Date: Tue, 11-Nov-86 17:41:05 EST Article-I.D.: elsie.7212 Posted: Tue Nov 11 17:41:05 1986 Date-Received: Tue, 11-Nov-86 21:01:35 EST Organization: NIH-LEC, Bethesda, MD Lines: 24 Keywords: ## One possibility for emulating most of the Reiser cpp's handling of #define CTRL(x) ('x' & 037) in proposed draft ANSI C is: #define CTRL_A ('A' & 037) #define CTRL_B ('B' & 037) ... #define CTRL_Z ('Z' & 037) #define CTRL_a ('a' & 037) ... #define CTRL_z ('z' & 037) #define CTRL(x) CTRL_ ## x A deficiency here is that the handling of constructs such as CTRL([) isn't emulated. . .but the above approach would handle most existing code. Or, at any rate, it would handle most existing code if the result of catenating preprocessing tokens with the "##" operator is itself macro expanded. Whether the Standard currently calls for such rescanning, whether the Standard will call for such rescanning in the future, and whether such rescanning is advisable are all open questions. -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.