CTRL(x)

Arthur David Olson ado at elsie.UUCP
Tue Oct 21 13:59:16 AEST 1986


Sorry if this has gone around before.

With the Reiser cpp, you can (and "/usr/include/sys/tty.h" does)
	#define	CTRL(c)	('c'&037)
so that a line such as
	CTRL(z)
turns into
	('z'&037)

With ANSI cpp, if you keep the define as above and have a line such as
	CTRL(z)
it turns into
	('c'&037)
which isn't what's wanted.

One possibility is to establish a new macro,
	#define Ctrl(c) ((c)&037)
and change all uses such as
	CTRL(z)
into uses such as
	Ctrl('z')

But. . .is there a way to write an ANSI cpp version of
	#define CTRL(c)
that will work like the old Reiser version?  If you know,
please mail me the answer.  Thanks.
--
ANSI may be an ANSI trademark.
--
	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