• Arguments 和Parameters 的区别


    今天在看ScottGu些的VS2010和.NET 4.0系列博客中Optional Parameters and Named Arguments in C# 4 (and a cool scenario w/ ASP.NET MVC 2) 时,想到Parameter和Argument应该都可以翻译成“参数”。但到底这两者有什么具体的区别还有去深究过(关于ScottGu这篇文章的内容大家有兴趣自己去看)。今天刚好有时间就在网上google下。

    先看看字典(灵格斯)的翻译:

    Parameter: 参数, 参量; 界限; 因素, 特征; 决定功能形式的变数; 传送到功能或程序并影响其操作的值 (计算机用语)

    Argument: 论据; 辩论; 争论; 缘由; 被应用到程序以及决定程序结果的可变物 (计算机用语)

    在看看网络上的翻译:

    Parameter:参数

    Argument:参数,引量,引数

    网络上的观点:

    1、有人的观点是:这两者没有区别

    2、有人说:

    Parameter是形参

    Argument是实参

    不过有人反对说:

    形参是Formal Parameter

    实参是Actual Parameter

    3、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; 
      }  

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    调用时用Argument,声明时用Parameter

    最后附上一个微软的术语翻译链接:http://www.microsoft.com/language/zh/cn/search.mspx

    参考资料:arguments 和 parameter的区别

    OOP 术语:Arguments(参量)和 Parameters(参数)的区别

    [讨论]:argument 和 parameter 的区别

    qishichang

  • 相关阅读:
    七天冲刺04
    软件工程概论项目——典型用户场景分析
    七天冲刺3
    七天冲刺2
    七天冲刺1
    第十三周总结
    软件工程概论个人作业02
    第二周学习进度
    软件工程个人作业01--四则运算
    连接数据库的javaee编译简易的WEB登陆界面
  • 原文地址:https://www.cnblogs.com/qishichang/p/1703559.html
Copyright © 2020-2023  润新知