What is a constant expression

Dave Jones djones at megatest.UUCP
Sat Oct 21 08:40:41 AEST 1989


>From article <1219 at crdos1.crd.ge.COM>, by davidsen at 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?



More information about the Comp.std.c mailing list