Laurent Deniau wrote:
C99 allows to write such macro, no needs for gcc tricks.
Using the COS macros from:
http://cos.cvs.sourceforge.net/cos/COS/src/cos/fpp/
Thank you for the information!!!
For my own education, I've tried to understand your macros.
Here is what I've understood :
#define count_args(...) get_nb_args(__VA_ARGS__, 3, 2, 1)
#define get_nb_args(pad1, pad2, pad3, n, ...) n
#define debug(...) debug_(count_args(__VA_ARGS__), __VA_ARGS__)
#define debug_(a, ...) debug##a(__VA_ARGS__)
#define debug1(a) debug_##a()
#define debug2(a, b) debug1(a); debug_##b()
#define debug3(a, b, c) debug2(a, b); debug_##c()
I've removed all the generic code to make it shorter and to work only in
this specific case.
It seems to work, but I've not carefully tested it in all situations.