🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #804

Re: What is a constant expression

#804
From: Dave Jones
Date: Fri, 20 Oct 1989 22:40
22 lines
967 bytes
From article <1219@crdos1.crd.ge.COM>, by davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr):
> 
...
>   Background: large program, defines ASCII control characters with a
> macro as follows:
> 	#define CNTL(c) ('c' & 037)
> While this work fine with pcc, the ANSI preprocessor doesn't expand it.

How about

#define CNTL(c) ((c) & 037)

Then change all occurances of the form

       CNTL(x)

into

       CNTL('x')

(Use an AWK program to automate things, if there's a bunch of them.)
Ain't that the "right" way to do it?
Technical Details
Message-ID: <8891@goofy.megatest.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!claris!sts!cohesive!megatest!djones
References: <1219@crdos1.crd.ge.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!claris!sts!cohesive!megatest!djones
From: djones@megatest.UUCP (Dave Jones)
Newsgroups: comp.std.c
Subject: Re: What is a constant expression
Message-ID: <8891@goofy.megatest.UUCP>
Date: 20 Oct 89 22:40:41 GMT
References: <1219@crdos1.crd.ge.COM>
Organization: Megatest Corporation, San Jose, Ca
Lines: 22