[lug] OT: CPP question

Ken Weinert mc at morat.net
Sun Mar 31 06:03:52 MST 2002


I've now lost the original post so I may have the conditions backward, but 
will this work?

#if defined(THIS)
#define MY_FUNC(x) some_function("'" #x "'")
#else
#define MY_FUNC(x) some_function(x)
#endif

I can't recall if it's cpp or the compiler that concatenates strings - if 
it's cpp then you'd need to double pass the file, if it's the compiler then I 
think this will work.

-- 
Ken Weinert   mc at morat.net
GnuPG KeyID: 9274F1CE           GnuPG available at http://www.gnupg.org/
GnuPG Key Fingerprint: 1D87 3720 BB77 4489 A928  79D6 F8EC DD76 9274 F1CE
Acronym -- IIABDFI If It Ain't Broke Don't Fix It




More information about the LUG mailing list