diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2007-04-12 22:42:49 +0000 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2007-04-12 22:42:49 +0000 |
| commit | c13182efa3b3d77f2563034c8212c0ca798243ca (patch) | |
| tree | e7652b26018b7c22cd6a4e4b41404dfaab911303 /man3/stdarg.3 | |
| parent | 4174ff5658082832c2ed511720f18881b3a80a34 (diff) | |
| download | man-pages-c13182efa3b3d77f2563034c8212c0ca798243ca.tar.gz | |
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
white space.
Diffstat (limited to 'man3/stdarg.3')
| -rw-r--r-- | man3/stdarg.3 | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/man3/stdarg.3 b/man3/stdarg.3 index dd56df80a4..e48609767f 100644 --- a/man3/stdarg.3 +++ b/man3/stdarg.3 @@ -53,7 +53,8 @@ stdarg \- variable argument lists .BI "void va_copy(va_list " dest ", va_list " src ); .SH DESCRIPTION A function may be called with a varying number of arguments of varying -types. The include file +types. +The include file .I <stdarg.h> declares a type .B va_list @@ -91,9 +92,10 @@ or as a function or an array type. The .BR va_arg () macro expands to an expression that has the type and value of the next -argument in the call. The parameter +argument in the call. +The parameter .I ap -is the +is the .B va_list .I ap initialized by @@ -102,7 +104,8 @@ Each call to .BR va_arg () modifies .I ap -so that the next call returns the next argument. The parameter +so that the next call returns the next argument. +The parameter .I type 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 @@ -110,9 +113,9 @@ has the specified type can be obtained simply by adding a * to .PP The first use of the .BR va_arg () -macro after that of the +macro after that of the .BR va_start () -macro returns the argument after +macro returns the argument after .IR last . Successive invocations return the values of the remaining arguments. .PP @@ -133,11 +136,13 @@ Each invocation of .BR va_start () must be matched by a corresponding invocation of .BR va_end () -in the same function. After the call +in the same function. +After the call .BI va_end( ap ) the variable .I ap -is undefined. Multiple transversals of the list, each +is undefined. +Multiple transversals of the list, each bracketed by .BR va_start () and @@ -171,7 +176,8 @@ it may be necessary for to allocate memory, store the parameters there, and also an indication of which parameter is next, so that .BR va_arg () -can step through the list. Now +can step through the list. +Now .BR va_end () can free the allocated memory again. To accommodate this situation, C99 adds a macro @@ -205,8 +211,8 @@ with each format character based on the type. #include <stdio.h> #include <stdarg.h> -void -foo(char *fmt, ...) +void +foo(char *fmt, ...) { va_list ap; int d; @@ -247,8 +253,8 @@ macro. .SH COMPATIBILITY These macros are .I not -compatible with the historic macros they replace. A backward compatible -version can be found in the include file +compatible with the historic macros they replace. +A backward compatible version can be found in the include file .IR varargs.h . .SH COMPARISON The historic setup is: @@ -256,9 +262,9 @@ The historic setup is: .nf #include <varargs.h> -void -foo(va_alist) - va_dcl +void +foo(va_alist) + va_dcl { va_list ap; @@ -284,7 +290,8 @@ Unlike the macros, the .B stdarg macros do not permit programmers to code a function with no fixed -arguments. This problem generates work mainly when converting +arguments. +This problem generates work mainly when converting .B varargs code to .B stdarg |
