CTRL(x) revisited

Arthur David Olson ado at elsie.UUCP
Wed Nov 12 08:41:05 AEST 1986


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 at seismo.ARPA
	DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.



More information about the Comp.lang.c mailing list