Memory safety depends entirely on GC ?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 23 10:30:13 PST 2015


On 2/23/15 10:27 AM, Adam D. Ruppe wrote:
> On Monday, 23 February 2015 at 18:16:38 UTC, Andrei Alexandrescu wrote:
>> The typechecker must WHILE COMPILING WIDGET, NOT ITS CLIENT know
>> whether getName() is okay or not.
>
> Aye, I haven't been following this thread closely, but I thought of this
> case a while ago myself and it actually led me to the belief that the
> this pointer needs to be scope unless the class itself is designed
> solely for GC use; escaping anything through it must not be allowed for
> guaranteed memory safety if it is manually freed in any form, whether
> refcounting, RAII, or free.
>
> If this is scope, then the usage site has freedom of deallocation
> method. If not, it must be known at design time of the class itself.

That's exactly right. There should be a DConf talk about that, 
apparently it's a widely misunderstood topic. -- Andrei


More information about the Digitalmars-d mailing list