November 1999
Intermediate to advanced
336 pages
6h 29m
English
When passing an object by value, the initialization of the formal parameter with the actual parameter is equivalent to the following form [ES90]:
T formalArg = actualArg;
where T is the class type. Suppose g() is some function expecting a T argument when invoked:
void g (T formalArg)
{
...
}
A typical invocation of g() may look like:
T t; g(t);
The activation record for g() has a place holder on the stack for its local argument formalArg. The compiler must copy the content of object t into g()'s formalArg on the stack. One popular technique of doing this will generate a temporary [Lip96I].
The compiler will create a temporary object of type T and copy-construct it using t as an input argument. This temporary will then be passed ...
Read now
Unlock full access