×

Loading...

Topic

  • 工作学习 / IT杂谈 / 请教C++中“implicit argument”是什么意思?
    • Is it "this" pointer?
    • Let me try...
      func(char* p, int i = 0, long l = 1)
      {
      ........
      }

      i and l is implicit argument
      • In my mind, it seems like only last argument is implicit argument in C++. right?
    • Agree with jabber
      • U r wrong! implicit argument is the last argument in argument list.
    • A few more words about this question
      本文发表在 rolia.net 枫下论坛There are two kinds of functions in C++: global ones and those in the class( let's forget about struct).

      I don't know the answer for the global functions. But for (non-static) class functions, I think the answer is "this" pointer. Just remind how the C++ compiler works: The programmer do not put "this" as an argument, but
      the C++ compiler will include it as it "decorates" the function signature.
      I also don't know the answer for the static function in a class.

      Well, I know some friends consider the following cases:

      1) void f() {}
      This fuction does not contain an explicit argument. But it is equivalent to having "void" as an argument.

      2) void f(int a=0; double d=0.0){}
      Here a=0 and d=0.0 are default value. It seems I have not yet heard there are named "implicit argument".

      I have checked some C++ books's index and I failed finding entries about "implicit arguments". I also consulted with two C++ gurus among my friends and they said they have no good ideas.

      If anybody know the complete answer, please tell us and give us some
      references.

      Thanks a lot.更多精彩文章及讨论,请光临枫下论坛 rolia.net