newbe macro preprocessor question
John (Eljay) Love-Jensen
eljay@adobe.com
Tue Jun 5 00:51:00 GMT 2007
Hi Andrea,
>I'm not understanding why "mypoint" definition isn't expanded in myDISP invocation ?
It isn't expanded because the macro has already failed due to insufficient arguments. (The arguments are parsed first, and come up short.)
There are several techniques to do deferred macro expansion, which would then work as desired. The easiest would be to make
#define myDISP2(mypointer, mybyte_and_bit) myDISP(mypointer, mybyte_and_bit)
Alternatively, if you are using C++, you could (and in my opinion, should) use inline functions instead of macro functions.
HTH,
--Eljay
More information about the Gcc-help
mailing list