[lug] OT: CPP question

Sexton, George gsexton at mhsoftware.com
Fri Mar 29 14:24:40 MST 2002


Ahh, I see. The trick is to use the -traditional flag when invoking CPP.

-----Original Message-----
From: lug-admin at lug.boulder.co.us [mailto:lug-admin at lug.boulder.co.us]On
Behalf Of Sexton, George
Sent: 29 March, 2002 1:55 PM
To: lug at lug.boulder.co.us
Subject: [lug] OT: CPP question


I have a question about CPP, and I was hoping someone could help me.

Given:

#ifdef THIS
#define MY_FUNC(x) SomeFunction(x)
#else
#define MY_FUNC(x) SomeOtherFunction(x)
#endif

MY_FUNC(some_literal);


If THIS is defined, I would like the output to be:

SomeFunction('some_literal');

but if THIS is not defined, I would like the output to be:

SomeOtherFunction(some_literal);

I tried MY_FUNC(x) SomeFunction('x') but it gives:

SomeFunction('x');

I tried MY_FUNC(x) SomeFunction(''x'') but it gives:

SomeFunction(''some_literal'');

Does anyone have an idea on how I can create the macro so that in one form
the output is the literal single quoted, but in another it is just the
literal?


George Sexton
MH Software, Inc.
Voice: 303 438 9585
http://www.mhsoftware.com


_______________________________________________
Web Page:  http://lug.boulder.co.us
Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug




More information about the LUG mailing list