RE: newbe macro preprocessor question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux