🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9651

Re: CTRL(x)

#9651
From: kb5mu
Date: Fri, 24 Oct 1986 07:56
12 lines
889 bytes
>But. . .is there a way to write an ANSI cpp version of
>        #define CTRL(c)

I don't have an ANSI cpp handy (does anybody?), so I can't test
this, but how about using the ANSI invention of # for "string-izing":
        #define CTRL(c) (#c[0] & 037)
This should turn
        CTRL(z)
into
        ("z"[0] & 037)
which would get what you wanted, except that relatively stupid
compilers might allocate storage for the string literal "z".
Technical Details
Message-ID: <4880@brl-smoke.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!brl-adm!brl-smoke!smoke!crash!pnet01!kb5mu@NOSC.ARPA

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!brl-adm!brl-smoke!smoke!crash!pnet01!kb5mu@NOSC.ARPA
From: kb5mu@NOSC.ARPA
Newsgroups: net.lang.c
Subject: Re: CTRL(x)
Message-ID: <4880@brl-smoke.ARPA>
Date: Fri, 24-Oct-86 02:56:31 EST
Article-I.D.: brl-smok.4880
Posted: Fri Oct 24 02:56:31 1986
Date-Received: Mon, 27-Oct-86 00:55:40 EST
Sender: news@brl-smoke.ARPA
Lines: 12