ANSIfication of #define ctl(X) ('X' & 0x1f)

Arthur David Olson ado at elsie.UUCP
Mon Jun 13 22:51:47 AEST 1988


> > More importantly, is there a way to do what I want to do without
> > changing the macro invocations?

> There isn't one.  Change the macro invocations.

For all practical purposes, change the header file to read

	#define LETR_A	'A'
	#define LETR_B	'B'
	/* ... */
	#define LETR_z	'z'

	#define CTRL(c)	((LETR_ ## c) & 037)

which will handle "calls" of CTRL with alphabetic arguments--the bulk of such
calls--correctly.  You then need only change the header file and any
non-alphabetic invocations (which the compiler politely lets you know about).
-- 
	ado at ncifcrf.gov			ADO is a trademark of Ampex.



More information about the Comp.lang.c mailing list