Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-09-13 07:05:36


"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?

-Thorsten


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