#define CTRL(x) followup
Arthur David Olson
ado at elsie.UUCP
Sun Nov 2 03:43:51 AEST 1986
Thanks to everyone who replied to my question on whether an emulation of
Reiser cpp's handling of
#define CTRL(x) ('x' & 037)
could be done in tentative proposed draft ANSI C.
The consensus is that the closest one came come is
#define CTRL(x) (#x[0] & 037)
with, perhaps, a "const" cast of appropriate type thrown in to allow for uses
such as
...
switch (input_char) {
case CTRL(z): stop();
...
And an idea for consideration: "lint" now reports on function arguments that
are not used; if it were extended to report on macro arguments that were not
used, then old, Reiser-style constructs such as
#define CTRL(x) ('x' & 037)
would result in "lint" warnings.
--
ANSI may be a trademark of ANSI.
Lint is a trademark of Oscar Madison.
--
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