Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Macro to count the number of arguments
Post
Macro to count the number of arguments
+4
−0
Let's say we have a function
void f(int argc, ...);
where argc
is the number of variadic arguments.
Can we write a macro of the form
#define F(...) f(CNT(__VA_ARGS__), __VA_ARGS__)
which passes the right value in argc
?
How can that CNT()
be implemented?
1 comment thread