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

List:       kde-devel
Subject:    Re: casting around...
From:       Michael Buesch <mbuesch () freenet ! de>
Date:       2005-06-04 17:55:29
Message-ID: 200506041955.29529.mbuesch () freenet ! de
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Quoting Sunil <funtoos@yahoo.com>:
> I understand that the static_cast cannot be used here
> and replacing these dynamic_cast ops with static_cast
> SHOULD NOT be done here. I am questioning whether its
> a good design to depend on the dynamic_cast to
> determine the type of the object so much. dynamic_cast
> implementation is twice as slow (if you work the
> relative numbers between dynamic_cast and static_cast)
> on cygwin compared to on linux. The overhead of
> dynamic_cast is 10 times (on linux) to a static_cast,
> and that is without accounting for the depth of the
> inheritance tree. The function I qouted in my email
> has a dynamic_cast in every other line. There is
> something wrong with the design there.

If someone is doing many dynamic_casts in some code, she
should think
"hey, can't I solve that with virtual functions, too?".
Only if the answer is "no", casts should be used.
IMHO there are not so much cases where the answer is "no",
if the code has a good design.

-- 
Greetings, Michael



[Attachment #5 (application/pgp-signature)]

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