summaryrefslogtreecommitdiffstats
path: root/man3/stdarg.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/stdarg.3')
-rw-r--r--man3/stdarg.333
1 files changed, 16 insertions, 17 deletions
diff --git a/man3/stdarg.3 b/man3/stdarg.3
index f3762f7..ce04704 100644
--- a/man3/stdarg.3
+++ b/man3/stdarg.3
@@ -13,7 +13,7 @@
.\" Converted for Linux, Mon Nov 29 15:11:11 1993, faith@cs.unc.edu
.\" Additions, 2001-10-14, aeb
.\"
-.TH stdarg 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH stdarg 3 2023-10-31 "Linux man-pages 6.7"
.SH NAME
stdarg, va_start, va_arg, va_end, va_copy \- variable argument lists
.SH LIBRARY
@@ -22,7 +22,7 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <stdarg.h>
-.PP
+.P
.BI "void va_start(va_list " ap ", " last );
.IB type " va_arg(va_list " ap ", " type );
.BI "void va_end(va_list " ap );
@@ -37,7 +37,7 @@ declares a type
.I va_list
and defines three macros for stepping through a list of arguments whose
number and types are not known to the called function.
-.PP
+.P
The called function must declare an object of type
.I va_list
which is used by the macros
@@ -55,12 +55,12 @@ for subsequent use by
and
.BR va_end (),
and must be called first.
-.PP
+.P
The argument
.I last
is the name of the last argument before the variable argument list, that is,
the last argument of which the calling function knows the type.
-.PP
+.P
Because the address of this argument may be used in the
.BR va_start ()
macro, it should not be declared as a register variable,
@@ -87,7 +87,7 @@ The argument
is a type name specified so that the type of a pointer to an object that
has the specified type can be obtained simply by adding a * to
.IR type .
-.PP
+.P
The first use of the
.BR va_arg ()
macro after that of the
@@ -95,12 +95,12 @@ macro after that of the
macro returns the argument after
.IR last .
Successive invocations return the values of the remaining arguments.
-.PP
+.P
If there is no next argument, or if
.I type
is not compatible with the type of the actual next argument (as promoted
according to the default argument promotions), random errors will occur.
-.PP
+.P
If
.I ap
is passed to a function that uses
@@ -144,30 +144,30 @@ argument, followed by the same number of
.BR va_arg ()
invocations that was used to reach the current state of
.IR src .
-.PP
+.P
.\" Proposal from clive@demon.net, 1997-02-28
An obvious implementation would have a
.I va_list
be a pointer to the stack frame of the variadic function.
In such a setup (by far the most common) there seems
nothing against an assignment
-.PP
+.P
.in +4n
.EX
va_list aq = ap;
.EE
.in
-.PP
+.P
Unfortunately, there are also systems that make it an
array of pointers (of length 1), and there one needs
-.PP
+.P
.in +4n
.EX
va_list aq;
*aq = *ap;
.EE
.in
-.PP
+.P
Finally, on systems where arguments are passed in registers,
it may be necessary for
.BR va_start ()
@@ -181,7 +181,7 @@ can free the allocated memory again.
To accommodate this situation, C99 adds a macro
.BR va_copy (),
so that the above assignment can be replaced by
-.PP
+.P
.in +4n
.EX
va_list aq;
@@ -190,7 +190,7 @@ va_copy(aq, ap);
va_end(aq);
.EE
.in
-.PP
+.P
Each invocation of
.BR va_copy ()
must be matched by a corresponding invocation of
@@ -222,7 +222,6 @@ T{
.BR va_arg ()
T} Thread safety MT-Safe race:ap
.TE
-.sp 1
.SH STANDARDS
C11, POSIX.1-2008.
.SH HISTORY
@@ -257,7 +256,7 @@ The function
.I foo
takes a string of format characters and prints out the argument associated
with each format character based on the type.
-.PP
+.P
.EX
#include <stdio.h>
#include <stdarg.h>