auto classes and finalizers
kris
foo at bar.com
Thu Apr 6 11:57:18 PDT 2006
Sean Kelly wrote:
> kris wrote:
>
>> Jarrett Billingsley wrote:
>>
>>>
>>> Hmm. 'auto' works well and good for classes whose references are
>>> local variables, but .. what about objects whose lifetimes aren't
>>> determined by the return of a function?
>>>
>>> I.e. the Node class is used only in LinkedList. When a LinkedList is
>>> killed, all its Nodes must die as well. Since the Node references
>>> are kept in the LinkedList and not as local variables, there's no way
>>> to specify 'auto' for them.
>>
>>
>> Heck, the LinkedList dtor /cannot/ rely on the nodes being valid if
>> they are also managed by the GC :)
>>
>> So, as I understand it, one cannot legitimately execute that example.
>
>
> ...unless the LinkedList has a deterministic lifetime :-)
>
>
> Sean
<g> Touché !
More information about the Digitalmars-d
mailing list