I have the following macro:
#define GTR(type) \
type type##_gtr(type a, type b) \
{ \
return a > b ? a : b;\
}
I understand that it generates functions, but if GTR(unsigned int) expands outside main(), how do I call the generated function? _gtr(a, b) does not work…
GTR(unsigned)would expand to:In that case, you should call
unsigned_gtr(a, b).GTR(unsigned int), however, would fail with a syntax error because you are having two separate tokens and the name of the function cannot be properly produced.