Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!rex!rouge!dlbres14 From: dlbres14@pc.usl.edu (Brumley David M) Newsgroups: comp.lang.c Subject: Re: Can pre-ANSI C Preprocessor handle symbolic constants in strings? Message-ID: Date: 1 Jun 91 09:03:12 GMT References: <1991May31.154937.24240@csrd.uiuc.edu> Sender: anon@rouge.usl.edu Organization: Univ. of Southwestern LA, Lafayette Lines: 29 In-reply-to: bliss@sp64.csrd.uiuc.edu's message of 31 May 91 15:49:37 GMT In article <1991May31.154937.24240@csrd.uiuc.edu> bliss@sp64.csrd.uiuc.edu (Brian Bliss) writes: > the following work on a sun and most other non-ANSI cpp's: > > #define quote(x) "x" > This doesn't work on the compiler in question (Laser C on an Atari ST, admittedly not a canonical compiler) which doesn't substitute for quoted arguments. The C compiler on our university's Pyramid-90x running OSx4.1 does the substitution (and hence is less compliant with ANSI than the PC compiler), but only once. So that with: #define CONSTANT 42 #define quote(x) "x" printf(quote(CONSTANT)); we get printf("CONSTANT"); not printf("42"); In any case this is all academic without string concatenation. -- David M. Brumley