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

List:       kde-core-devel
Subject:    Re: KPresenter
From:       Reginald Stadlbauer <reggie () troll ! no>
Date:       1999-11-01 23:12:56
[Download RAW message or body]

On Tue, 02 Nov 1999, Don Sanders wrote:
>On Tue, 02 Nov 1999, Reginald Stadlbauer wrote:
>> On Mon, 01 Nov 1999, Kurt Granroth wrote:
>> >Reginald Stadlbauer wrote:
>> >> I mean, you can always live without C++ casts, because
>> >> 
>> >> dynamic_cast<AClass>( aPtr )->doSomething()
>> >> 
>> >> can be replaced by
>> >> 
>> >> ( (AClass*)aPtr )->soSomething().
>> >> 
>> >> Itīs just that the first (C++) solution is the better one.
>> >
>> >Why is it better?  I'll admit that I've never used dynamic_cast before
>> >as I couldn't see the point.
>> 
>> dynamic_casts do typechecking. So, if it fails, it returns a NULL-pointer.
>> AFAIK a C cast would just segfault. But as I donīt check the result of each
>> dynamic_cast the result is the same :-)
>> 
>> And to be honest: Iīm not using dynamic_casts anymore, but I just donīt want 
>> to go over all the KPresenter and KWord sources and revert the casts :-)
>
>Considered using static_cast? Isn't it recommended for solving exactly the
>problem being experienced? 
>
>I'm using static_cast as the programmers FAQ said don't use dynamic_cast
>unless you have to, and I didn't want to use C style casts, as I was under the
>impression that would mean I would burn in hell for all eternity.
>
>The search/replace expression would be simpler and quite probably revertable
>(you don't have any variables name dynamic_cast do you?).

Still, it would be a work which is not necessary, and I can spend the time
doing more useful KDE stuff :-) And as it works now again anyway, Iīll not
revert the casts.

-- 
Reggie

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

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