Uh... destructors?

Stewart Gordon smjg_1998 at yahoo.com
Wed Feb 23 03:43:56 PST 2011


On 23/02/2011 01:22, %u wrote:
>>> - private makes no sense since (unless we're trying to imitate C++ here) destructors are only called from
> the runtime, and nowhere else.
>>> - The only meaningful attribute there is extern(C).
>
>> In what way is extern(C) meaningful for a destructor?
>
> I guess it would be logical to specify that, if someone is desperately trying to get C code to interop with
> D. But I don't think it's too useful... it's just not meaningless.
<snip>

To me it doesn't make sense for C code to call a D object's destructor.  For a start, it 
would bypass the D runtime that ensures that an object is destructed only once.  How would 
the name be mangled, anyway?

Stewart.


More information about the Digitalmars-d mailing list