From fe7bdd630fab35270a88b0731cd0fc10de062046 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 2 Apr 1997 22:06:24 +0000 Subject: Update. 1997-04-02 16:55 Ulrich Drepper * manual/socket.texi: Document behaviour of inet_ntoa in multi- threaded programs. * manual/stdio.texi: Change wording for snprintf description a bit. Correct typo in example. * manual/lang.texi: Add documentation of __va_copy. * Makefile: Add rule to easily generate dir-add.texi file. * manual/Makefile: Likewise. * manual/arith.texi: Add description of lldiv_t, lldiv, and atoll. Change description of strtoll and strtoull to make clear these are the preferred names. Describe `inf', `inifinity', `nan', `nan(...)' inputs for strtod and friends. Change references to HUGE_VALf and HUGE_VALl to HUGE_VALF and HUGE_VALL. * sysdeps/libm-ieee754/s_nan.c: Use strtod if parameter is not empty * sysdeps/libm-ieee754/s_nanl.c: Likewise. --- manual/lang.texi | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'manual/lang.texi') diff --git a/manual/lang.texi b/manual/lang.texi index 39bba83540..7520da2fbe 100644 --- a/manual/lang.texi +++ b/manual/lang.texi @@ -462,6 +462,44 @@ use it except for reasons of portability. @refill @end deftypefn +Sometimes it is necessary to parse the list of parameters more than once +or one wants to remember a certain position in the parameter list. To +do this one will have to make a copy of the current value of the +argument. But @code{va_list} is an opaque type and it is not guaranteed +that one can simply assign the value of a variable to another one of +type @code{va_list} + +@comment stdarg.h +@comment GNU +@deftypefn {Macro} void __va_copy (va_list @var{dest}, va_list @var{src}) +The @code{__va_copy} macro allows copying of objects of type +@code{va_list} even if this is no integral type. The argument pointer +in @var{dest} is initialized to point to the same argument as the +pointer in @var{src}. + +This macro is a GNU extension but it will hopefully also be available in +the next update of the ISO C standard. +@end deftypefn + +If you want to use @code{__va_copy} you should always be prepared that +this macro is not available. On architectures where a simple assignment +is invalid it hopefully is and so one should always write something like +this: + +@smallexample +@{ + va_list ap, save; + @dots{} +#ifdef __va_copy + __va_copy (save, ap); +#else + save = ap; +#endif + @dots{} +@} +@end smallexample + + @node Variadic Example @subsection Example of a Variadic Function -- cgit v1.2.3