CTRL(X) in ANSI standard

BALDWIN mike at whuxl.UUCP
Mon May 6 03:15:36 AEST 1985

> #define CTRL(XX) ( ($XX)[0] & '\037') 
>	replaces
> #define CTRL(XX) ('XX' & '\037')

A more reasonable definition without any weirdness would be

#define	CTRL(c)	((c) & '\037')

So you use CTRL('g') instead of CTRL(g).  This way it looks more like
a real function call (rather than passing some nonexistent variable g).

Here's a silly though:  since '\xFC' has been added to ANSI C for hex
characters, how about '\^G' for control characters, ala ICON?  I never
did like the CTRL macro.
						Michael Baldwin
						AT&T Bell Labs

More information about the Comp.lang.c mailing list