all In glusterfs's functions, there is one as follows NOTES: the whole define in stack.h
//libglusterfs/src/glusterfs/stack.h
#define STACK_WIND(frame, rfn, obj, fn, params...) \
STACK_WIND_COMMON(frame, rfn, 0, NULL, obj, fn, params)
#define STACK_WIND_COMMON(frame, rfn, has_cookie, cky, obj, fn, params...) \
do { \
... \
next_xl_fn(_new, obj, params); \
THIS = old_THIS; \
} while (0)
I did not google search anything about explaining such declaring methods, any idea will be appreciated?
params...as part of function-like macro is a GNU extension before C standardized ellipsis as part of arguments of function-like macros.See https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html#Variadic-Macros
Nowadays, prefer
__VA_ARGS__.No, they are not equal in function-like macros. The first one needs to use
__VA_ARGS__to reference variadic arguments and use__VA_OPT__or##__VA_ARGS__to remove leading comma. In theparams...thenparamsis straight up replaced by all the arguments including commas.Doing just ellipsis
, ...)and using__VA_ARGS__would be equal to, params...)and usingparams.In normal functions
params...as part of parameter-list is just invalid.