crystal clear()

Steven Schveighoffer schveiguy at yahoo.com
Fri Sep 17 15:27:43 PDT 2010


On Fri, 17 Sep 2010 18:18:00 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Fri, 17 Sep 2010 18:15:58 -0400, Steven Schveighoffer  
> <schveiguy at yahoo.com> wrote:
>
>> On Fri, 17 Sep 2010 18:11:11 -0400, Steven Schveighoffer  
>> <schveiguy at yahoo.com> wrote:
>>
>>> On Fri, 17 Sep 2010 18:07:54 -0400, Andrei Alexandrescu  
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>
>>>> On 09/17/2010 04:55 PM, Steven Schveighoffer wrote:
>>>>> On Fri, 17 Sep 2010 17:33:11 -0400, Andrei Alexandrescu
>>>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>>>
>>>>>> I think clear() can be fixed if we remove the call to the  
>>>>>> constructor
>>>>>> AND obliterate the vptr.
>>>>>
>>>>> agreed.
>>>>
>>>> One more thing: we need to change the call to the destructor to check  
>>>> the vptr. If the vptr is null, no call to the destructor. Where is  
>>>> that piece of code? Couldn't find it by grepping for __dtor.
>>>
>>> lifetime.d?  Looks like it might already check for null classinfo ;)
>>>
>>> http://www.dsource.org/projects/druntime/browser/trunk/src/rt/lifetime.d#L1002
>>
>> Wait, I don't know enough about object I think.  Is there ClassInfo  
>> *and* vtable in the object?  Probably...
>
> Nevermind, it looks like rt_finalize is already doing something similar  
> in the finally clause.  So it looks like vptr's first member is the  
> classinfo.
>
> Is there a map somewhere of what the hidden data in an object looks like?

I should stop asking questions that I can find the answers to with minimal  
effort :)

http://www.digitalmars.com/d/2.0/abi.html

But here is a legitimate question, how do we get the interfaces?  There's  
no indication in the ABI of where the interfaces are.  I know from logic  
that they must be before the data members.  But logic also says that  
interfaces defined by the derived types must appear after the data members  
of the base class.  This is indeed tricky.

Maybe we just need to leave the interfaces intact.

-Steve


More information about the Digitalmars-d mailing list