[size=medium]看ant的时候,发现里面用到var和arguments,不知道两个的区别,google之,然后就知道了。隐秘的知识,不经意的收获,惊喜,遂记之。
在 ANSI/ISO C++ Professional Programmer 's Handbook 中:
Arguments and Parameters
The words arguments and parameters are often used interchangeably in the literature, although the Standard makes a clear distinction between the two. The distinction is chiefly important when discussing functions and templates.
Argument
An argument is one of the following: an expression in the comma-separated list that is bound by the parentheses in a function call; a sequence of one or more preprocessor tokens in the comma-separated list that is bound by the parentheses in a function-like macro invocation; the operand of a throw-statement or an expression, type, or template-name in the comma-separated list that is bound by the angle brackets in a template instantiation. An argument is also called an actual parameter.
Parameter
A parameter is one of the following: an object or reference that is declared in a function declaration or definition (or in the catch clause of an exception handler); an identifier from the comma-separated list that is bound by the parentheses immediately following the macro name in a definition of a function-like macro; or a template-parameter. A parameter is also called a formal parameter.
The following example demonstrates the difference between a parameter and an argument:
void func(int n, char * pc); //n and pc are parameters
template <class T> class A {}; //T is a a parameter
int main()
{
char c;
char *p = &c;
func(5, p); //5 and p are arguments
A <long> a; // 'long ' is an argument
A <char> another_a; // 'char ' is an argument
return 0;
}[/size]
在 ANSI/ISO C++ Professional Programmer 's Handbook 中:
Arguments and Parameters
The words arguments and parameters are often used interchangeably in the literature, although the Standard makes a clear distinction between the two. The distinction is chiefly important when discussing functions and templates.
Argument
An argument is one of the following: an expression in the comma-separated list that is bound by the parentheses in a function call; a sequence of one or more preprocessor tokens in the comma-separated list that is bound by the parentheses in a function-like macro invocation; the operand of a throw-statement or an expression, type, or template-name in the comma-separated list that is bound by the angle brackets in a template instantiation. An argument is also called an actual parameter.
Parameter
A parameter is one of the following: an object or reference that is declared in a function declaration or definition (or in the catch clause of an exception handler); an identifier from the comma-separated list that is bound by the parentheses immediately following the macro name in a definition of a function-like macro; or a template-parameter. A parameter is also called a formal parameter.
The following example demonstrates the difference between a parameter and an argument:
void func(int n, char * pc); //n and pc are parameters
template <class T> class A {}; //T is a a parameter
int main()
{
char c;
char *p = &c;
func(5, p); //5 and p are arguments
A <long> a; // 'long ' is an argument
A <char> another_a; // 'char ' is an argument
return 0;
}[/size]