Variadic macro and trailing comma
I am trying to do object-orientation in C and want to have a syntactic sugar macro for the notation object->vtable->method(object, arg1, arg2) into send(object, method, arg1, arg2) Unfortunately when a method takes no argument, the trailing comma problem arises send(object, method) gives object->vtable->method(object, ) Is there any portable (no ##__VA_ARGS__ or Visual Studio) way of doing this? I figured out one but I need to swap the object and the method #define FIRST_ARG_(N, ...) N #define FIRST_ARG(args) FIRST_ARG_(args) #define send(msg, ...) \ FIRST_ARG(__VA_ARGS__)->vtable->msg(__VA