cpp/language/variadic arguments

Allows a function to accept any number of extra arguments.

Indicated by a trailing  following the  of a.

When the is not empty, an optional comma may precede a  signifying a variadic function. This provides compatibility with C (which added a requirement for a comma when it adopted function prototypes from C++).

Default conversions
When a variadic function is called, after lvalue-to-rvalue, array-to-pointer, and function-to-pointer, each argument that is a part of the variable argument list undergoes additional conversions known as default argument promotions:


 * arguments are converted to as in
 * ,, , and unscoped enumerations are converted to or wider integer types as in

Only arithmetic, enumeration, pointer, pointer to member, and class type arguments (after conversion) are allowed. However,, are conditionally-supported in potentially-evaluated calls with implementation-defined semantics (these types are always supported in ).

Because variadic parameters have the lowest rank for the purpose of, they are commonly used as the catch-all fallbacks in.

Within the body of a function that uses variadic arguments, the values of these arguments may be accessed using the library facilities:

The behavior of the va_start macro is undefined if the last parameter before the ellipsis has reference type, or has type that is not compatible with the type that results from default argument promotions.