CTRL(x)

kb5mu at NOSC.ARPA kb5mu at NOSC.ARPA
Fri Oct 24 17:56:31 AEST 1986


>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".



More information about the Comp.lang.c mailing list