Article View: comp.std.c
Article #780Re: What is a constant expression
From: Doug Gwyn
Date: Thu, 19 Oct 1989 10:18
Date: Thu, 19 Oct 1989 10:18
19 lines
1212 bytes
1212 bytes
In article <1219@crdos1.crd.ge.COM> davidsen@crdos1.UUCP (bill davidsen) writes:
> #define CNTL(c) ('c' & 037)
> What am I missing in the standard? In looking up initializers in the
>index, section 3.5.7 (L14) uses the term "constant expression." However
>the index doesn't seem to list that term.
Sure it does:
constant expressions, 3.4
> Don't waste your time telling me that's a bad way to do the macro, I
>didn't write it, and I don't defend it.
My recommendation for this abuse of the preprocessor, widely encountered
in code from Berkeley UNIX systems, is to change the macro to
#define CNTRL(c) ((c) & 037)
then globally edit the source code to wrap the arguments with '',
e.g. in "ed":
g/CTRL(/s/CTRL(\(.\))/CNTRL('\1')/g
Technical Details
Message-ID:
<11339@smoke.BRL.MIL>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwynReferences:
<1219@crdos1.crd.ge.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: What is a constant expression Message-ID: <11339@smoke.BRL.MIL> Date: 19 Oct 89 10:18:28 GMT References: <1219@crdos1.crd.ge.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 19