ANSI C stdarg questions

Chris Torek chris at mimsy.umd.edu
Thu Dec 21 20:39:08 AEST 1989


In article <8217 at pixar.UUCP> rta at pixar.UUCP (Rick Ace) writes:
>1)  Is it legal ANSI C for test() to pass the argument "ap" to
>    print1() and print2() as it does in the above program [deleted]?

Yes.  Unfortunately, it is not legal afterwards to do more with `ap'
in test().

>2)  Is it legal ANSI C to traverse the argument list multiple times?
>[using va_start + series of va_arg + va_end + va_start + va_arg + va_end]

Yes, this is explicitly allowed.

As you noted, the only real problem is the obnoxious (and completely
unnecessary, since the `...' syntax must be recognised by the compiler
and therefore compilers could recognise some other hidden syntax for
va_start's expansion) requirement for an `anchor' (the `x' in your
`test').
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list