Oct 30, 2013 at 10:23am UTC
Hi,
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 Oct 30, 2013 at 10:24am UTC
Oct 30, 2013 at 11:08am UTC
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 Oct 30, 2013 at 11:12am UTC
Oct 30, 2013 at 1:12pm UTC
Thank you for the reply cubbi :)
Oct 30, 2013 at 1:30pm UTC
To give you an example, this is how va_start is defined in one of the compilers I use:
1 2
#define va_start(__list,__parmN) __list = (char *)((unsigned long)&(__parmN) \
+ (((sizeof(__parmN)+7)/8)*8))
(and
va_list
is simply
char *
)
Last edited on Oct 30, 2013 at 1:32pm UTC