]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gcc/extensions-to-the-c-language-family/pointer-arguments-in-variadic-functions.rst
sphinx: copy files from texi2rst-generated repository
[thirdparty/gcc.git] / gcc / doc / gcc / extensions-to-the-c-language-family / pointer-arguments-in-variadic-functions.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: pointer arguments in variadic functions, variadic functions, pointer arguments
7
8 .. _variadic-pointer-args:
9
10 Pointer Arguments in Variadic Functions
11 ***************************************
12
13 Standard C requires that pointer types used with ``va_arg`` in
14 functions with variable argument lists either must be compatible with
15 that of the actual argument, or that one type must be a pointer to
16 ``void`` and the other a pointer to a character type. GNU C
17 implements the POSIX XSI extension that additionally permits the use
18 of ``va_arg`` with a pointer type to receive arguments of any other
19 pointer type.
20
21 In particular, in GNU C :samp:`va_arg (ap, void *)` can safely be used
22 to consume an argument of any pointer type.