🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9698

#define CTRL(x) followup

#9698
From: Arthur David Olson
Date: Sat, 01 Nov 1986 17:43
31 lines
1325 bytes
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@seismo.ARPA
	DEC, VAX, Elsie & Ado are Digital, Borden & Ampex trademarks.
Technical Details
Message-ID: <7136@elsie.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!elsie!ado

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!elsie!ado
From: ado@elsie.UUCP (Arthur David Olson)
Newsgroups: net.lang.c
Subject: #define CTRL(x) followup
Message-ID: <7136@elsie.UUCP>
Date: Sat, 1-Nov-86 12:43:51 EST
Article-I.D.: elsie.7136
Posted: Sat Nov  1 12:43:51 1986
Date-Received: Mon, 3-Nov-86 23:13:49 EST
Organization: NIH-LEC, Bethesda, MD
Lines: 31