Re: [gtkmm] Replacing dynamic_cast<> with static_cast<> - compiler error.
- From: Murray Cumming <murrayc usa net>
- To: Paulo Pinto <pjmlp progtools org>
- Cc: gtkmm-main <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Replacing dynamic_cast<> with static_cast<> - compiler error.
- Date: 18 Sep 2002 15:34:49 +0100
On Wed, 2002-09-18 at 15:29, Paulo Pinto wrote:
> > Unfortunately you are right. Since we're dealing with pointers for the
> > polymorphism then the compiler can't know what will be passed in so a
> > static_cast cannot be used. The dynamic_cast checks at run time and will
> > throw an exception if the cast cannot be meaningfully performed.
> >
> > Nick
>
>
> Right. I know that it doesn't sound pretty but we could replace the
> dynamic_cast
> with a reinterpret_cast or even an old style cast (ugh did I just said
> that?).
That would compile, but would cause crashes. That's why we have
static_cast<>, dynamic_cast<> etc.
--
Murray Cumming
murrayc usa net
www.murrayc.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]