Udostępnij za pośrednictwem


The Argument Declaration List

The argument declaration list portion of a function declaration:

  • Allows the compiler to check type consistency among the arguments the function requires and the arguments supplied in the call.

  • Enables conversions, either implicit or user-defined, to be performed from the supplied argument type to the required argument type.

  • Checks initializations of, or assignments to, pointers to functions.

  • Checks initializations of, or assignments to, references to functions.

Multiple argument declarations are listed separated by commas.

Functions that may take a variable number of arguments are specified by using the ellipsis operator () in place of the variable arguments. If the ellipsis is present, it must be the last element in the argument list. See Variable Argument Lists.

Each argument declaration consists of:

  • Declaration specifiers, including the type specifier. Specifically, this means:

    • A storage class specifier auto or register.

    • const and/or volatile.

    • The type specifier.

  • A declarator, which may be abstract. A non-abstract declarator like allows the argument to be named; an abstract declarator specifies an anonymous argument. Specifically, this means:

    • An optional * or & specifying a pointer or reference.

    • An optional identifier naming the argument.

    OR

    • Any complex declarator specifying any composition of pointer, reference, function pointer, and array to fully specify the type.
  • An initializer specifying the default value of the argument. Specifically, argument initializers consist of

Note that many of the Microsoft-specific keywords can appear in the declaration specifiers and in the declaration of the name.

See Also

Reference

Function Declarations