Hi,
I want to define a macro in C like this, but I wonder if these is too obscure and I'm starting to get too nasty.
This is the macro I want to use:
Later I plan to call it like this:
So, do you think the call later is readable? Or does it make you want to puke?
Any idea will be greatly appreciated.
TIA & Regards ...
I want to define a macro in C like this, but I wonder if these is too obscure and I'm starting to get too nasty.
This is the macro I want to use:
Code:
#define CompareXYAndDoActions(X, Y, greaterAction, equalAction, lowerAction) \ { \ if (X>Y) { \ greaterAction; \ } \ if (X==Y) { \ equalAction; \ } \ if (X<Y) { \ lowerAction; \ } \ }
Code:
CompareXYAndDoActions(X, Y, { Action1; }, { Action2; }, { Action3; } );
Any idea will be greatly appreciated.
TIA & Regards ...
Comment