Standard C Libraries -. More...
Go to the source code of this file.
Macros | |
#define | va_arg(ap, Ty) |
#define | va_end(ap) (void)0 |
#define | va_start(ap, last_arg) AP=(void *) __builtin_next_arg (LASTARG) |
Standard C Libraries -.
The header file, stdarg.h, supports functions with variable argument lists. This allows functions to have arguments without corresponding parameter declarations. There must be at least one named argument. The variable arguments are represented by ellipses (...). An object of type, va_list, must be declared inside the function to hold the arguments. va_start will initialize the variable to an argument list, va_arg will access the argument list, and va_end will end the use of the argument.
The documentation in this header file has been copied from the documentation provided with the Microchip MPLAB XC16 compiler. The original license agreement included with the XC16 compiler applies!
#define va_arg | ( | ap, | |
Ty | |||
) |
Description: The type va_list declares a variable that will refer to each argument in a variable-length argument list.
Include: <stdarg.h>
Example:
See va_arg. Description: Gets the current argument.
Include: <stdarg.h>
ap | pointer to list of arguments |
Ty | type of argument to be retrieved |
Remarks:
va_start must be called before va_arg.
Example:
Output:
<83> is an integer
<This is text.> is a string
. is unknown
%c is an unknown format
#define va_end | ( | ap) | (void)0 |
Description: Ends the use of ap.
Include: <stdarg.h>
ap | pointer to list of arguments |
Remarks:
After a call to va_end, the argument list pointer, ap, is considered to be invalid. Further calls to va_arg should not be made until the next va_start. In the 16-bit compiler, va_end does nothing, so this call is not necessary but should be used for readability and portability.
Example:
See va_arg.
#define va_start | ( | ap, | |
last_arg | |||
) | AP=(void *) __builtin_next_arg (LASTARG) |
Description: Sets the argument pointer ap to first optional argument in the variable-length argument list.
Include: <stdarg.h>
ap | pointer to list of arguments |
last_arg | last named argument before the optional arguments |
Example:
See va_arg.