I'm trying to understand how to handle varargs in a macro function conformingly (i.e. avoiding gcc's comma swallowing ##__VA_ARGS__). I wrote this:
#define IS_DEFINED(ARG) strlen(#ARG)
#define FOO(a, ...) \
    if(IS_DEFINED(__VA_ARGS__)){\
        printf(#a, __VA_ARGS__)\
    } else {\
        printf(#a)\
    }
But it does not generate a valid program test. FOO(1) expands to
if(strlen("")){ printf("1", ) } else { printf("1") };
which does not compile.
Is there a way to handle a case of vararg macro function with one parameter and vararg?
 
    