Memory safety depends entirely on GC ?

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 23 10:27:29 PST 2015


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.


More information about the Digitalmars-d mailing list