This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: newbe macro preprocessor question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]