W3cubDocs

/GCC 11

6.25 Pointer Arguments in Variadic Functions

Standard C requires that pointer types used with va_arg in functions with variable argument lists either must be compatible with that of the actual argument, or that one type must be a pointer to void and the other a pointer to a character type. GNU C implements the POSIX XSI extension that additionally permits the use of va_arg with a pointer type to receive arguments of any other pointer type.

In particular, in GNU C ‘va_arg (ap, void *)’ can safely be used to consume an argument of any pointer type.

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Variadic-Pointer-Args.html