Passing a `va_list *'

Roland McGrath mcgrath at paris.Berkeley.EDU
Sun Oct 29 09:09:27 AEST 1989


My example did indeed have typos.  What I meant was:

#include <stdarg.h>

void
foo(const char *s, ...)
{
  va_list args;
  va_start(args, s);
  bar1(va_arg(args, int));
  ack(&args);
  bar2(va_arg(args, float *));
  va_end(args);
}

void ack(va_list *args)
{
  blip(va_arg(*args, int **));
}


I have a somewhat old draft of the Standard (May 1988), but I can't find
anything that actually says this isn't allowed.

I don't see the problem with whatever type `va_list' is.  You can take the
address of an object of any type (though not every storage class), and
dereference the pointer thus obtained.
--
	Roland McGrath
	Free Software Foundation, Inc.
roland at ai.mit.edu, uunet!ai.mit.edu!roland



More information about the Comp.std.c mailing list