Preprocessor macro to quote its argument

R. Kym Horsell vu0310 at bingvaxu.cc.binghamton.edu
Mon Aug 27 03:53:37 AEST 1990


In article <GJG5YDA at ggpc2.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:
\\\
>If you define CTRL(c) ((*#c)^('\177'^'?')) it'll handle '^?' for delete as
>well, at the expense of producing gibberish for CTRL(a).

I think the original

#define	CTRL(c)	((*#c)-64)

did this correctly anyway. It just makes me nervous that it also didn't
handle lower-case; I came across a nasty bug once involving the
programmer's misunderstanding of what CTRL(x) would match!

-Kym Horsell



More information about the Comp.lang.c mailing list