Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

#define CTRL(x) followup

17 views
Skip to first unread message

Arthur David Olson

unread,
Nov 1, 1986, 12:43:51 PM11/1/86
to
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!a...@seismo.ARPA
DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.

0 new messages