[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: kdelibs/kdeui
From: Joseph Wenninger <jowenn () jowenn ! at>
Date: 2003-09-21 19:48:01
[Download RAW message or body]
Hi
Am Son, 2003-09-21 um 18.23 schrieb George Staikos:
> This is incorrect code. Please fix it. If you are sure that dynamic_cast<>
> will never return 0 then please use static_cast<>. If you aren't sure, then
> you are writing code that is guaranteed to crash.
>
> On Friday 19 September 2003 17:54, Joseph Wenninger wrote:
> > }
> > - if (obj->d->isContainer)
> > dynamic_cast<KDockContainer*>(obj->widget)->save(c); + if
> > (obj->d->isContainer)
> > dynamic_cast<KDockContainer*>(obj->widget)->save(c,group);
>
> Bzzzt. dynamic_cast<foo*>()-> is always wrong. You must check for null.
static_cast doesn't work here.
The inheritance looks like class Something : public SomeQWidgetClass,
public KDockContainer.
It is ensured by the if statement that the widget really inherits from
KDockWidget, but a static cast doesn't work in this case:
kdockwidget.cpp: In member function `void
KDockManager::writeConfig(KConfig*,
QString)':
kdockwidget.cpp:2366: error: invalid static_cast from type `QWidget*' to
type `
KDockContainer*'
Kind regards
Joseph Wenninger
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic