On Sat, May 11, 2019 at 08:52:32PM +0100, Piotr Oleskiewicz wrote: > I would prefer to > write > > X(int, i, 1) > > rather than > > X(int, i, atoi, "%d", 1) > > Many thanks, > Piotr >
That is going to be tough, as in C in a macro, there is no way to really determine what type name you were given. The only thing standard C has to offer to help is "sizeof", but that doesn't help you, obviously. (sizeof(float) == sizeof(int)). In C++, you'd have "typeid", but then you'd also have C++, so that's a hard pass. However, would you be willing to settle for X_INT(i, 1) ? Ciao, Markus