vararg warning


I am using the vararg (NOT Variadic functions). For the below function

void test_read(int stmt_id, long *testval, ...)
int vl_length = get_length(stmt_id);
va_list vl;
va_start(vl, vl_length);

it shows warning

"second parameter of 'va_start' not last named argument"

Basically I determine the length by the use of stmt_id rather than by passing it as a parameter.

How can I overcome this warning. Is there a flag to ignore just this warning?
Last edited on
va_start doesn't take any sort of length as its second argument, it takes the last named parameter (testval in this case). There is no sensible way to use it differently.
Last edited on
Thank you for the reply cubbi :)
To give you an example, this is how va_start is defined in one of the compilers I use:

#define va_start(__list,__parmN) __list = (char *)((unsigned long)&(__parmN) \
+ (((sizeof(__parmN)+7)/8)*8)) 

(and va_list is simply char*)
Last edited on
Topic archived. No new replies allowed.