Need help with quoting and the CPP
Stanley Friesen
sarima at tdatirv.UUCP
Wed Apr 24 05:13:48 AEST 1991
In article <1991Apr22.014237.16836 at cunixf.cc.columbia.edu> jhz at cunixa.cc.columbia.edu (Jennifer H. Zemsky) writes:
<In article <230 at wimpy.nms.gdc.portal.com> bergquis at nms.gdc.portal.com (Brett Bergquist) writes:
<>Is there any way to define a macro "QUOTE" so that:
<>
<>char* s = QUOTE(STRING);
<>
<>will produce:
<>
<>char *s = "test string";
<from k&r (2nd ed), 4.11.2:
<if ... a parameter is preceded by a # in the replacement text, the combination
<will be expanded into a quoted string with the parameter replace by the actual
<argument. This can be combined with string concatenation to make, for
<example, a debugging print macro:
<
<#define dprint(expr) printf(#expr " = %g\n",expr)
<When this is invoked, as in
Except that Mr Bergquist explicitly stated he was using the SuOS 4.1 C
compiler, which is *not*, I repeat, *not*, ANSI conformant. It does not
support this ANSI-ism. (Sun has 'graciously' provided a seperate, unbundled
ANSI compliant compiler).
So folks, which way does Sun C blow? Which of the non-portable, pre-ANSI
methods actually works with this compiler?
it it:
#define QUOTE(string) "string"
or is it somehing else?
--
---------------
uunet!tdatirv!sarima (Stanley Friesen)
More information about the Comp.lang.c
mailing list