[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Some thoughts on kdelibs et al.
From:       Martijn Klingens <martijn () martijn ! homeip ! net>
Date:       2001-09-27 12:44:11
[Download RAW message or body]



On Thu, 27 Sep 2001, Guillaume Laurent wrote:

> On Thursday 27 September 2001 14:05, Harri Porten wrote:
> >
> > As dynamic_cast has some overhead I'd only used when really needed (i.e.
> > you are uncertain about the type).
>
> AFAIK the overhead is very small, while the fact that it allows you to check
> the result is a huge benefit.

Though Marc's example was something along the lines of (class*)foo->bar(),
in which case a dynamic_cast isn't quite an advantage. calling methods on
pointers that are potentially null if dynamic_cast fails is asking for
trouble...

So the only case where this type of casting (and calling) is used is where
you are sure that you casn cast, so I'd opt for static_cast instead.

I agree, though, that the old C-style casts should be tried to get rid of.

Martijn


 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic