[En-Nut-Discussion] NutEventPostFromIrq and C++

Harald Kipp harald.kipp at egnite.de
Sun Jul 30 19:54:03 CEST 2006

Hi Matthias,

I didn't check the final compiler result. For this specific case
I'm quite sure that the macro version results in smallest and
fastest code for C.

I didn't think about any impact on C++. Actually I didn't understand
your critics. If I'm not fully misunderstanding the procedure,
the macro is handled by the preprocessor. Neither the C nor C++
compiler will ever see any reference to NutEventPostFromIrq().

Further, the macro still uses a pointer reference to NUTTHREADINFO.
I can't see, why a copy constructor would be required. The code

         NUTTHREADINFO *tp = *qp;    \
         tp->td_qpec++;              \

could be interpreted as

         (NUTTHREADINFO *(*qp))->td_qpec++; \

Did I miss something?


At 17:46 30.07.2006 +0200, you wrote:
>Hello all,
>I do not know exactly from which version you introduced the 
>"new"  NutEventPostFromIrq "function", might be 4.1.9rc4. However, I am 
>not really happy with this style. You replaced the function by a macro 
>define which is not very helpfull using C++. So my code demands now copy 
>constructors for NUTTHREADINFO....
>However, I can not see any reason why you introduced a macro and do not 
>stick for the function, which would work fine for me. Just to make clear, 
>I do not claim the new modification / implementation of the function 
>itself. So, if there is not really a reason, please do not use defines, 
>which also recommends Scott Meyers  ;-)

More information about the En-Nut-Discussion mailing list