I try to get at the first actual parameter sent to a variadic macro. This is what I tried, and which does not work in VS2010:
I know 开发者_运维问答I can do this: #define MACRO(api, ...) \\ bool ret = api(123, ##__VA_ARGS__);
GCC complains if I do this: #define M(obj,met, ..., contents) obj##_##met(const void * self, __VA_ARGS__) { \\
After reading about VA_NARG I tri开发者_如何学编程ed to implement function overloading depending on number of arguments in C using macros.
Consider this macro: #define MAKE_TEMPLATE(...) template <typename T, __VA_ARGS__ > When used with zero arguments it produces bad code since the compiler expects an identifier after the comma
I\'m trying to do some kind of Macro \"Overloading\", so that MACRO(something), gets expanded differently than MACRO(something, else).
主料:蒜200g猪瘦肉100g辅料:葱姜青椒两个调料:色拉油40g料酒10g味精1g盐2g蒜猪肉做法:
I need a way to define a FLAGS_IF macro (or equivalent) such that FLAGS_IF(expression) <block_of_code>
Simple question for which I could not find answer on the net. In variadic argument macros, how to find the number of arguments?I am okay with boost preprocessor, if it has the开发者_C百科 solution.