paramter 和argument

 

 

    在阅读jQuery文档时,原本不注意的两个英文单词paramter 和argument引起了我的注意,为什么特定的语义环境下用特定的单词?至少他们两个之间应该有区别,但究竟区别何在呢?我做了一番搜索,经过对比总结,发现一篇中的内容比较有道理,居然是英文的。虽然也找到了一些中文关于两个词的比较,但感觉没有这个全面,而且一下就得到的结论总觉得靠不足。现在把原文贴出来,留作备忘。

 

The words argument and parameter are often used interchangeably in the literature, although the C++ Standard makes a clear distinction between the two. An argument is one of the following: an expression in the comma-separated list in a function call; a sequence of one or more preprocessor tokens in the comma-separated list in a macro call; the operand of a throw-statement or an expression, type, or template-name in the comma-separated list in the angle brackets of a template instantiation. 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 between the parentheses immediately following the macro name in a macro definition; or a template-parameter. This 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;
}
虽然文章是以c++语言做的解释,但从另外一个角度佐证了parameter是形参而argument是实参

原文出处:Understanding the Difference Between an Argument and a Parameter

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值