arocc
arocc copied to clipboard
Preprocessor: __VA_OPT__ function macro
Description here https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
clang only supports this in C++ mode with -std=c++2a. gcc supports it in all C standards but issues a pedantic warning warning: __VA_OPT__ is not available until C++2a in non-GNU standards.
Example usage:
#define eprintf(format, ...) fprintf (stderr, format __VA_OPT__(,) __VA_ARGS__)
eprintf("test");
eprintf("test", 2);
After preprocessor expansion these become:
fprintf (stderr, "test" );
fprintf (stderr, "test" , 2);