📄 ansistdarg.c
字号:
/* ansiStdarg.c - ANSI `stdarg' documentation *//* Copyright 1984-1993 Wind River Systems, Inc. *//*modification history--------------------01b,16mar93,jdi documentation cleanup for 5.1.01a,24oct92,smb written.*//*DESCRIPTIONThe header stdarg.h declares a type and defines three macros for advancingthrough a list of arguments whose number and types are not known to thecalled function when it is translated.A function may be called with a variable number of arguments of varying types.The rightmost parameter plays a special role in the access mechanism, andis designated <parmN> in this description.The type declared is:.iP `va_list' 12a type suitable for holding information needed by the macrosva_start(), va_arg(), and va_end()..LPTo access the varying arguments, the called function shall declare an objecthaving type `va_list'. The object (referred to here as <ap>) may bepassed as an argument to another function; if that function invokes theva_arg() macro with parameter <ap>, the value of <ap> in the callingfunction is indeterminate and is passed to the va_end() macro priorto any further reference to <ap>.va_start() and va_arg() have been implemented as macros, not asfunctions. The va_start() and va_end() macros should be invoked in thefunction accepting a varying number of arguments, if access to the varyingarguments is desired.The use of these macros is documented here as if they were architecture-generic.However, depending on the compilation environment, different macro versions areincluded by vxWorks.h.SEE ALSO: American National Standard X3.159-1989*/ /********************************************************************************* va_start - initialize a `va_list' object for use by va_arg() and va_end()* * This macro initializes an object of type `va_list' (<ap>) for subsequent* use by va_arg() and va_end(). The parameter <parmN> is the identifier of* the rightmost parameter in the variable parameter list in the function* definition (the one just before the , ...). If <parmN> is declared with* the register storage class with a function or array type, or with a type* that is not compatible with the type that results after application of the* default argument promotions, the behavior is undefined.* * RETURNS: N/A*/void va_start ( ap, /* list of type va_list */ parmN /* rightmost parameter */ ) { /* dummy function for documenation purposes */ }/********************************************************************************* va_arg - expand to an expression having the type and value of the call's next argument* * Each invocation of this macro modifies an object of type `va_list' (<ap>)* so that the values of successive arguments are returned in turn. The* parameter <type> is a type name specified such that the type of a pointer* to an object that has the specified type can be obtained simply by* postfixing a * to <type>. If there is no actual next argument, or if* <type> is not compatible with the type of the actual next argument (as* promoted according to the default argument promotions), the behavior is* undefined.* * RETURNS:* The first invocation of va_arg() after va_start() returns the value of the* argument after that specified by <parmN> (the rightmost parameter).* Successive invocations return the value of the remaining arguments in* succession.*/void va_arg ( ap, /* list of type va_list */ type /* type */ ) { /* dummy function for documenation purposes */ }/********************************************************************************* va_end - facilitate a normal return from a routine using a `va_list' object** This macro facilitates a normal return from the function whose variable* argument list was referred to by the expansion of va_start() that* initialized the `va_list' object.* * va_end() may modify the `va_list' object so that it is no longer* usable (without an intervening invocation of va_start()). If there is no* corresponding invocation of the va_start() macro, or if the va_end() macro* is not invoked before the return, the behavior is undefined.* * RETURNS: N/A*/void va_end ( ap /* list of type va_list */ ) { /* dummy function for documenation purposes */ }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -