Path: utzoo!telly!ddsw1!lll-winken!uunet!tut.cis.ohio-state.edu!mailrus!purdue!decwrl!ucbvax!nutmeg.Berkeley.EDU!rab
From: rab@nutmeg.Berkeley.EDU
Newsgroups: gnu.gcc
Subject: control macro
Message-ID: <26200@ucbvax.BERKELEY.EDU>
Date: 23 Sep 88 05:12:30 GMT
Sender: usenet@ucbvax.BERKELEY.EDU
Reply-To: rab@nutmeg.Berkeley.EDU ()
Organization: University of California, Berkeley
Lines: 16


Several of my old C programs used the following macro for control
characters:

#define CTRL(c)     ('c'&0x1f)

Since this no longer works with ansi c, I replaced it with the
following macro:

#define CTRL(c)     ((#c[0])&0x1f)

so CTRL(x) will expand to  (("x"[0])&0x1f)

Now, this works fine, but it is inefficient when compiled with gcc.
Since this code involves extracting data at a constant offset
from a constant array, it seems to me that an obvious optimization
would be to do it at compile time.