Z
zoe
I am trying to master the variable argument list!
C99 tells me:
7.15.1.4 The va_start macro:
1 #include <stdarg.h>
void va_start(va_list ap, parmN);
4 The parameter parmN is the identifier of the rightmost parameter in
the variable parameter list in the function definition (the one just
before the , ...).
But then i see in 7.15.1.4.7:
void f3(int n_ptrs, int f4_after, ...)
{
va_list ap, ap_save;
char *array[MAXARGS];
int ptr_no = 0;
if (n_ptrs > MAXARGS)
n_ptrs = MAXARGS;
va_start(ap, n_ptrs); ??????
Should this be va_start(ap, f4_after)?
I thought that the parmN is used, by the va_start macro, to "find" the
address of the first variable argument (the one just after the one
before ,...) and let ap 'point' to that.
Am i mistaking, probably so, but where?
Zoe
C99 tells me:
7.15.1.4 The va_start macro:
1 #include <stdarg.h>
void va_start(va_list ap, parmN);
4 The parameter parmN is the identifier of the rightmost parameter in
the variable parameter list in the function definition (the one just
before the , ...).
But then i see in 7.15.1.4.7:
void f3(int n_ptrs, int f4_after, ...)
{
va_list ap, ap_save;
char *array[MAXARGS];
int ptr_no = 0;
if (n_ptrs > MAXARGS)
n_ptrs = MAXARGS;
va_start(ap, n_ptrs); ??????
Should this be va_start(ap, f4_after)?
I thought that the parmN is used, by the va_start macro, to "find" the
address of the first variable argument (the one just after the one
before ,...) and let ap 'point' to that.
Am i mistaking, probably so, but where?
Zoe