Recently, I asked this question where one of the answers says:
There's no such thing as "implicit this parameter" in the standard. The standard calls it an "implicit object parameter".
Then someone commented that:
There's no such thing as "implicit this parameter" in the standard." seems wrong. From expr.call#4: "If the function is a non-static member function, the
this
parameter of the function shall be initialized with a pointer to the object of the call, converted as if by an explicit type conversion."
Seeing the above comment i think that the answer is technically incorrect because the answer said that "There's no such thing as "implicit this parameter" in the standard." while the standard clearly talks about the this parameter.
So how to interpret this further (pun intended)? I mean, it seems that the standard makes a distinction between the non-static member function and a constructor in the context of this
parameter. For example, the standard says that for a non-static member function, the this
parameter of the function shall be initialized with a pointer to the object of the call converted as if by an explicit type conversion. But the standard doesn't say the same for constructors. So why does the standard makes this distinction? I mean why doesn't the standard says that constructors also have an this
parameter that get initialized by the passed argument just like for non-static member functions. This again leads to the deeper question that if there is no this
parameter in the constructor unlike non-static member function, then how are we able to use this
inside the constructor. For example, we know that we can write this->p = 0
inside the constructor as well as inside a non-static member function, where p
is a data member. But in case of non-static member function, this
is a parameter of that particular member function so this->p
makes sense. But in case of constructor this
is not a parameter, so how are we able to use this->p
inside the constructor.
Originally, by reading the answers here, I thought that the implicit this
parameter is an implementation detail. But after reading expr.call#4 it seems that it is not an implementation detail.
Here's a quotation from this Draft C++17 Standard (bolding for emphasis, and to answer the question, is mine):
However I should add that the cited paragraph doesn't seem to be present in this later Draft Standard. In fact, that (later) Standard seems to use the phrase, "implicit object parameter," in similar clauses.
So, maybe you should add a specific version tag to your question: c++17 or c++20, as there appears to be a divergence in the use (or not) of the term.
Note that the above citation is the only occurrence of the phrase, "implicit this parameter" in that Draft Standard.
Also, note that both documents I have linked are only Draft versions of the respective Standards, and both come with this cautionary escape-clause: