[Kst] Re: branches/work/kst/portto4/kst
Peter Kümmel
syntheticpp at gmx.net
Sun Jan 2 13:59:59 CET 2011
Thanks, but it is clear what KstSharedPtr does, I only wonder why we need
this functionality. I create a branch where I could "think aloud".
On 01.01.2011 19:59, Barth Netterfield wrote:
> On Sun, Jan 2, 2011 at 6:26 AM, Peter Kümmel <syntheticpp at gmx.net> wrote:
>> I also discovered by my own that the main problem is the switching
>> between raw pointers and smart pointers. I will investigate it
>> further because I wonder why we need to pass raw pointers around
>> and to understand how it works at the moment.
>
> Here is some very brief documentation on K[st]SharedPtr:
>
> K[st]SharedPtr is a smart reference counted pointer where the
> reference count is held by the object
> being pointed to. For this reason, the object must inherit from K[st]Shared.
>
> It can be used like a normal pointer. When the reference count gets
> to zero, the object is deleted. Having the KSharedPtr go out of
> scope, or being set to 0 decrements the reference count.
>
> A bare pointer can be converted to a K[st]SharedPtr. The reference
> count is incremented.
>
> You can also manually increment or decrement the reference count
> (->ref() and ->unref()) if needed - like to protect the passing of a
> bare pointer.
>
> I think K[st]SharedPtr is a good class.
>
> There is some 'spooky stuff' related to slave scalars in kst2 which I
> think might be wrong. In particular, I'm not sure why ->ref() and
> ->unref() are being used in some places.
>
>> But I will be very
>> carefully and when the changes become to big I'll make a branch.
>>
>> I think the benefits will be a simpler to maintain code, less memory
>> leaks, maybe more type checking by the compiler and at least I will
>> understand the code better. Working on this we get a lot of help from
>> the compiler and of Qt's checks in QSharedPointer, so I'm confident
>> that there will be not too much big surprises at runtime. So let's
>> see how far will get.
>>
>> Threading would be good with all these cores around.
>>
>> Peter
>>
>> PS, the BLAST pages are very interesting. But I have no
>> real imagination how Kst looks like in your real world
>> application. Do you think some screen shots are worth to
>> add to our web page?
>
> I'll send or post some at some point.
>
More information about the Kst
mailing list