Macro parameters getting substituted into strings
John Gilmore
gnu at hoptoad.uucp
Tue Mar 29 00:24:06 AEST 1988
ado at elsie.UUCP (Arthur David Olson) wrote:
> Here's an example (taken from "/usr/include/sys/ttychars.h") of how we coped
> with the problem here at elsie...
>
> #if !defined __STDC__ && !defined __DECUS_CPP__
> #define CTRL(c) ('c'&037)
> #else /* defined __STDC__ || defined __DECUS_CPP__ */
> #ifndef LETR_a
> #define LETR_a 'a'
> #define LETR_b 'b'
> #define LETR_c 'c'
>... #define LETR_y 'y'
> #define LETR_z 'z'
> #define LETR_A 'A'
> #define LETR_B 'B'
>... #define LETR_Z 'Z'
> #endif /* !LETR_a */
> #define CTRL(c) ((LETR_ ## c) & 037)
> #endif /* defined __STDC__ || defined __DECUS_CPP__ */
When I was 14 years old I wrote a program in an early BASIC (which
did not support characters at all, just numbers), that would mess around
with words (each character stored as a number) and print them out.
The printout routine looked like:
4000 if (i = 1) print "A";
4010 if (i = 2) print "B";
4020 if (i = 3) print "C";
4030 if (i = 4) print "D";
and so on...
I was hoping to never have to do that sort of thing again.
--
{pyramid,ptsfa,amdahl,sun,ihnp4}!hoptoad!gnu gnu at toad.com
"Watch me change my world..." -- Liquid Theatre
More information about the Comp.lang.c
mailing list