#include <cstdio>
#define REPORT(...) printf(__VA_ARGS__);
int main()
{
REPORT("%s %s %s\n", "ME", "MYSELF", "I");
return 0;
}
// Output: ME MYSELF I
Reference: https://isocpp.org/wiki/faq/cpp11-language-misc#cpp11-c99
Tuesday, August 22, 2017
C++11: Variadic Macros
You can define Macros that take an arbitrary number of arguments. Here is an example:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment