Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!adm!lhc!nih-csl!elsie.nci.nih.gov!ado From: ado@elsie.nci.nih.gov (Arthur David Olson) Newsgroups: comp.lang.c Subject: Re: Macros in ANSI C Message-ID: <1039@nih-csl.nih.gov> Date: 4 Mar 91 21:29:28 GMT References: <1172@intelisc.isc.intel.com> Sender: news@nih-csl.nih.gov Lines: 23 > In the old C if you wanted to define a macro to convert its parameter to a > char you would. . . > #define conv(s) 's' > . . .In ANSI C the "'" prevents evaluation of the enclosed characters. > . . .Is there a way to escape the "'"s, in ANSI C? For many practical purposes, what works is to #define LETR_A 'A' #define LETR_B 'B' /* ... */ #define LETR_Z 'Z' #define LETR_a 'a' #define LETR_b 'b' /* ... */ #define LETR_z 'z' #define conv(s) ((LETR_ ## s) & 037) -- The Multiprocessor Turing Instruction Set Computer: TISC-TISC Arthur David Olson ado@elsie.nci.nih.gov ADO and Elsie are Ampex and Borden trademarks