[fdo-dev] Pre-conditions and unsafe constuctions
mateusz at loskot.net
Thu Dec 7 14:37:23 EST 2006
Mateusz Loskot wrote:
> Brent Robinson wrote:
>> In the FdoRdbmsMySqlConnection::NewSchemaManager()
>> example, a straight assignment:
>> FdoSmPhMySqlMgrP physMgr = schMgr->GetPhysicalSchema();
>> fails to compile. Something like the following would work:
>> FdoSmPhMySqlMgrP physMgr =
> What is this C-cast for?
> Why not to provide raw pointer accessor, something like
> std::auto_ptr<T>::get(), then no dirty C casts are needed.
I've forgot there is FdoPtr<T>::p member, that provides
access to raw pointer.
So, no C-style is needed and the code can be cleaner:
AFAIK, the call schMgr->GetPhysicalSchema() returns smart-ptr
object FdoSmPhMgrP, and there is FdoSmPhMgrP::p which is
of type of FdoSmPhMgr*
Unless, there is some magic I don't see again ;-)
More information about the Fdo-internals