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

List:       kde-core-devel
Subject:    Re: about kde4's smart pointer
From:       "Michel Hermier" <michel.hermier () gmail ! com>
Date:       2006-10-04 7:47:15
Message-ID: 2e631f490610040047of29f8bdlb25fe80151cd2e68 () mail ! gmail ! com
[Download RAW message or body]

If I remember well, this problem is visible due to an *hole* in the C++ grammar.
How to interpret Foo foo = new Bar;
Some compiler (like gcc) change this as Foo foo(new Bar); for me this
is a mistake and should be interpreted as Foo foo; foo = new Bar; .
While I agree, it should do the same thing, it's not an obligation to
do so. So if the user really meant to do Foo foo(new Bar); it as to
write it, else it's the 2 steps construction.

2006/10/4, Cyrille Berger <cberger@cberger.net>:
> > Or dynamicCast, if you're going the other way.
> Well without smart pointers, I can do KisDevice* device = new
> KisPaintDevice(); And as I think smart pointers should behave like C++
> pointers I should be able to do it. Of course, KisPaintDeviceSP pd = device;
> shouldn't be possible.
>
> --
> --- Cyrille Berger ---
>
[prev in list] [next in list] [prev in thread] [next in thread] 

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