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

List:       kde-devel
Subject:    Re: MORE INFO (Re: What is the difference between dynamic and
From:       Michael Matz <matzmich () cs ! tu-berlin ! de>
Date:       2000-11-16 16:55:10
[Download RAW message or body]

Hi,

On Thu, 9 Nov 2000, Thomas Leitner wrote:
> Is it legal to dynamic_cast from a base_class* to a derived_class* ?

Yes, as others have mentioned already. I'm a bit late ;)

> On Wed, 8 Nov 2000 cxxc_bugs@cxxc.zko.dec.com wrote:
> > if (fti==0)
> > printf("type of qlvi is %s value of qlvi %p\n",typeid(qlvi).name(),qlvi);
> >
> > and send back the output.
> 
> This is the output:
> 
> type of qlvi is QListViewItem * value of qlvi 140135560
                  ^^^^^^^^^^^^^^^^

Exactly this is the problem. The variable qlvi points to a object which
_really_ is a QListViewItem (and not a KMFolderTreeItem). At least this is
what the RTTI says, and on this dynamic_cast<> is based. Now, others have
assured, that to this function only pointers to KMFolderTreeItem objects
are given. If this is true, _and_ it's true, that RTTI support on Compaq
CXX is the default (and not turned off), then it's a bug in CXX's RTTI
support, as typeid(qlvi).name() should be == "KMFolderTreeItem *" if qlvi
actually points to a KMFolderTreeItem object.


Ciao,
Michael.

 
>> Visit http://master.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