Talking about scanf

Karl Heuer karl at ima.isc.com
Sun Nov 18 11:16:32 AEST 1990


In article <1990Nov16.125504.305 at sc2a.unige.ch> fisher at sc2a.unige.ch writes:
>As another workaround, it seems that some compilers *do* expand macros inside
>strings and character constants, in which case you could use the `X' there.

I refuse to believe that.  Some non-ANSI preprocessors expand *macro
arguments* inside string literals within the macro, but I've never heard of
one that expanded macros in string literals in the program.  It would break
too much code.

>In TC, for example, you can "stringize" a macro...

It's not a TC invention; stringizing and string literal pasting are available
in all ANSI C compilers.  Note that it doesn't help you if X was defined as an
expression like `(99+1)', since the C preprocessor (unlike, say, m4) doesn't
have a way to reduce constant expressions.

Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list