I'm trying to write a basic macro like this:
#define USER_ERROR(fmt, ...) { \
fprintf(stderr, "ERROR %s(): %s\n", __func__, fmt, ##__VA_ARGS__); \
} \
my ideal usage:
USER_ERROR("something went wrong %s %s", more_detail, even_more_detail);
unfortunately, I'm getting a compilation error:
data argument not used by format string
I know that single %s
handles one argument, but how can I make the formatter variadic?
%s
can't itself contain format specifiers (that will be interpreted).