Is there a way to count the number of variadic macro arguments in C?I found a way to check if the list is empty: examine sizeof(STR((__VA_ARGS__))) where STR is a macro that stringifies its argument. If it is 3, __VA_ARGS__ is empty. I wonder if there is a less hackish approach.
The macro arguments are expressions, but not of a uniform type, so an array-based approach does not work.
-- Florian Weimer / Red Hat Product Security Team