Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-09-13 10:54:14


"Thorsten Ottosen" <nesotto_at_[hidden]> writes:

> "Thorsten Ottosen" <nesotto_at_[hidden]> wrote in message
> news:bju2k1$7kk$1_at_sea.gmane.org...
>> >From the documentation:
>>
>> >The C++ built-in dynamic_cast can be used for downcasts and crosscasts of
>> pointers to polymorphic objects, but error notification in the form of a
>> >returned value of 0 is inconvenient to test, or worse yet, easy to forget
>> to test. The polymorphic_cast template performs a dynamic_cast, and throws
>> an >exception if the dynamic_cast returns 0.
>>
>> what is the difference between this and
>>
>> dynamic_cast<Derived&>( *obj ) ?
>
> get it, this is actually ill-formed code since we might dereference the
> null-pointer. Maybe the documentation could
> state this more explicitly?

Please submit a patch!

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk