Alf P. Steinbach wrote:
...
>In C++ there's no syntax and way in general to "explicitly call" a
constructor.
I'm sorry, that's incorrect.
There's no dedicated C++ syntax for constructor calls. What the syntax
means depends on context. Whether to say that an explicit constructor
call is an explicit constructor call is a terminologial issue.
I disagree. Constructors are functions. They are special functions, but
functions nevertheless. For this reason I'd expect the "explicit
constructor call", if it existed, to be have the function call
semantics. However, if I'm not mistaken, there's no way to call
constructor in C++ by using function call semantics. Constructors calls
in C++ are "side effects" of the more generic process called
"initialization". It is is invoked by various language constructs
having... well, initialization semantics, which is essentially different
from function call semantics. This is why I say that there's no way to
"call" a constructor in C++.
The language's creator calls an explicit constructor call an explicit
constructor call.
Where? In TC++PL? If yes, then sorry, but that book is not canonical in
the context of ANSI standard C++ discussion. It is intentionally
simplified to be more accessible for newcomers. And the price of that
simplification is that sometimes it makes statements, which are simply
incorrect from the standard C++ point of view. (For example, it states
that scalar types have constructors, if I remember correctly).
--
Best regards,
Andrey Tarasevich