Embedding macro values in strings
Garrett Wollman
wollman at emily.uvm.edu
Sun Jan 13 11:09:41 AEST 1991
Doug Gwyn will probably yell at me...
#define foo_bar(baz) "Line " #baz
#define foo() foo_bar(__LINE__)
I *think* that this will work; I can't remember the exact order of
application here, which was posted by one of the net.c.gurus a while
back. It will work if the preprocessor expands __LINE__ before it
expands foo_bar(). [I.e., is the C preprocessor a lazy or non-lazy
evaluator?] Someone might have quotations from the relevant sections
of the Standard?
-GAWollman
Garrett A. Wollman - wollman at emily.uvm.edu
Disclaimer: I'm not even sure this represents *my* opinion, never
mind UVM's, EMBA's, EMBA-CF's, or indeed anyone else's.
More information about the Comp.lang.c
mailing list