Re: [gtkmm] Replacing dynamic_cast<> with static_cast<> - compilererror.



I know but I thought that you just wanted to
replace dynamic_cast due to the gcc gcc2.9* bug.

Replacing the dynamic_cast might lead to crahes
whatever you do because you loose the type check
that is performed by it.

--
Paulo Pinto

----- Original Message -----
From: "Murray Cumming" <murrayc usa net>
To: "Paulo Pinto" <pjmlp progtools org>
Cc: "gtkmm-main" <gtkmm-list gnome org>
Sent: Wednesday, September 18, 2002 3:34 PM
Subject: Re: [gtkmm] Replacing dynamic_cast<> with static_cast<> -
compilererror.


> 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
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]