P99
|
◆ P99_VA_ARGS
Helper macro to declare a variable length parameter list. Inside the declared function X will be of type Wrap your function in a macro that uses P99_LENGTH_VA_ARG. If used through that macro, the correct value for X will always be provided at compile time. Declare such a function as follows: #define toto(A, ...) P99_FSYMB(toto)(A, P99_LENGTH_VA_ARG(__VA_ARGS__))
In the definition of the function you may then use the unsigned ret = 0;
va_list ap;
va_start(ap, number);
ret += va_arg(ap, unsigned);
}
va_end(ap);
return ret % a;
}
In this toy example unsigned magic = toto(3, 1, 3, 5, 7);
which will result in converting 1, 3, 5, 7 (the variable arguments) to
Definition at line 213 of file p99_args.h. |