3 ms·
> - I wanted a form to register new types, so it could work for user-defined types; Yes, I had the same urge. You can easily fall into the trap of too many fe
by tinkersleep 5y ago
> - I wanted a form to register new types, so it could work for user-defined types;
Yes, I had the same urge. You can easily fall into the trap of too many features on the list. I settled on keeping user types out: you can always write a stringify() and pass that to the printf. Not the same, I know. But a more finite project.
> - the C pre-processor knows nothing about lists that can be expanded multiple times;
Yeah, that's a hack. Look at the 'VA_EXP()' macros in include/va_print/base.h. Ugly. Incomprehensible.
> - variadic C macros are ugly hacks.
Absolutely. But I think there is no other way in C.
> Actually, if the C pre-processor supported lists, it would be possible to implement RTTI in C.
I couldn't resist to put in '%t' which prints the C type of the argument...