avoid some overlong lines from posix urls, etc.
[gnulib.git] / doc / posix-functions / va_arg.texi
1 @node va_arg
2 @section @code{va_arg}
3 @findex va_arg
4
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/va_arg.html}
6
7 Gnulib module: ---
8
9 Portability problems fixed by Gnulib:
10 @itemize
11 @end itemize
12
13 Portability problems not fixed by Gnulib:
14 @itemize
15 @item
16 The second argument of @code{va_arg} must be a type that is invariant under
17 the ``default argument promotions'' (ISO C 99 6.5.2.2 paragraph 6).  This
18 means that the following are not valid here:
19 @table @asis
20 @item @samp{float}
21 Use @samp{double} instead.
22 @item @samp{bool}
23 Use @samp{int} instead.
24 @item Integer types smaller than @samp{int}.
25 Use @samp{int} or @samp{unsigned int} instead.
26 @end table
27
28 This is a portability problem because you don't know the width of some
29 abstract types like @code{uid_t}, @code{gid_t}, @code{mode_t}.  So, instead of
30 @smallexample
31 mode = va_arg (ap, mode_t);
32 @end smallexample
33 you have to write
34 @smallexample
35 mode = (sizeof (mode_t) < sizeof (int)
36         ? va_arg (ap, int)
37         : va_arg (ap, mode_t));
38 @end smallexample
39 @end itemize