[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
another thing to avoid
- To: <roland@son-of-blob>, <xtech@son-of-blob>
- Subject: another thing to avoid
- From: <eric@son-of-blob>
- Date: Fri, 13 Jul 90 16:40:05 PDT
Another one for xlint to catch:
DerivedClass::DerivedClass (ArgType * arg)
: BaseClass (::function(arg)) {
...
}
If function(arg) allocates any storage, the object under construction may
vanish during garbage collection. It would not matter here if the
DerivedClass constructor had a saveThis strong pointer since its scope
will not have been entered, so nothing is pointing to the new object.
The arguments for BaseClass may only be trivial, such as constants or
unprocessed pointers.