Forwarding a variable argument list
int printf_debug(const char *format, ...) { va_list va; va_start(va, format); int ret = vfprintf(iodebug, format, va); va_end(va); return ret; } The function initializes traversal state after its last named parameter, forwards that state to vfprintf, and then releases it. section 16.5.2
va_list is the C library type representing traversal state for a variable argument list. stdarg.h supplies it together with macros for starting, reading, copying, and ending traversal. section 16.5.2
Use the associated macros as a lifecycle:
- Call va_start with the va_list object and the last named parameter. section 16.5.2
- Retrieve each value with va_arg, supplying its expected type explicitly. section 16.5.2
- Call va_end after traversal; use va_copy when an independent traversal is needed. section 16.5.2
1 void va_start(va_list ap, parmN);
2 void va_end(va_list ap);
3 type va_arg(va_list ap, type);
4 void va_copy(va_list dest, va_list src);
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":1}],[{\"line\":0,\"ch\":4},{\"line\":0,\"ch\":8}],[{\"line\":1,\"ch\":4},{\"line\":1,\"ch\":8}],[{\"line\":3,\"ch\":4},{\"line\":3,\"ch\":8}],[{\"line\":0,\"ch\":9},{\"line\":0,\"ch\":17}],[{\"line\":0,\"ch\":18},{\"line\":0,\"ch\":25}],[{\"line\":1,\"ch\":16},{\"line\":1,\"ch\":23}],[{\"line\":2,\"ch\":16},{\"line\":2,\"ch\":23}],[{\"line\":3,\"ch\":17},{\"line\":3,\"ch\":24}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":1}],[{\"line\":0,\"ch\":4},{\"line\":0,\"ch\":8}],[{\"line\":1,\"ch\":4},{\"line\":1,\"ch\":8}],[{\"line\":3,\"ch\":4},{\"line\":3,\"ch\":8}],[{\"line\":1,\"ch\":9},{\"line\":1,\"ch\":15}],[{\"line\":0,\"ch\":18},{\"line\":0,\"ch\":25}],[{\"line\":1,\"ch\":16},{\"line\":1,\"ch\":23}],[{\"line\":2,\"ch\":16},{\"line\":2,\"ch\":23}],[{\"line\":3,\"ch\":17},{\"line\":3,\"ch\":24}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":1}],[{\"line\":2,\"ch\":9},{\"line\":2,\"ch\":15}],[{\"line\":0,\"ch\":18},{\"line\":0,\"ch\":25}],[{\"line\":1,\"ch\":16},{\"line\":1,\"ch\":23}],[{\"line\":2,\"ch\":16},{\"line\":2,\"ch\":23}],[{\"line\":3,\"ch\":17},{\"line\":3,\"ch\":24}],[{\"line\":3,\"ch\":0},{\"line\":3,\"ch\":1}],[{\"line\":0,\"ch\":4},{\"line\":0,\"ch\":8}],[{\"line\":1,\"ch\":4},{\"line\":1,\"ch\":8}],[{\"line\":3,\"ch\":4},{\"line\":3,\"ch\":8}],[{\"line\":3,\"ch\":9},{\"line\":3,\"ch\":16}],[{\"line\":0,\"ch\":18},{\"line\":0,\"ch\":25}],[{\"line\":1,\"ch\":16},{\"line\":1,\"ch\":23}],[{\"line\":2,\"ch\":16},{\"line\":2,\"ch\":23}],[{\"line\":3,\"ch\":17},{\"line\":3,\"ch\":24}],[{\"line\":0,\"ch\":18},{\"line\":0,\"ch\":25}],[{\"line\":1,\"ch\":16},{\"line\":1,\"ch\":23}],[{\"line\":2,\"ch\":16},{\"line\":2,\"ch\":23}],[{\"line\":3,\"ch\":17},{\"line\":3,\"ch\":24}]]"}
!@%STYLE%@!
Shows the pseudo-interfaces for the four operations associated with va_list. section 16.5.2

