Memory safety depends entirely on GC ?

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 21 12:13:25 PST 2015


On Saturday, 21 February 2015 at 19:38:02 UTC, Peter Alexander 
wrote:
> @safe @nogc
>
> :-)
>
> (I rewrote the post a few times. Originally I just wrote "mark 
> main @safe @nogc and you're fine", but I think it's a bit 
> misleading since @nogc is still difficult to use, so I wrote 
> about that instead and forgot to mention @safe at all. Thanks 
> for pointing out.)

free is an unsafe operation. Unless you don't allocate at all or 
choose to leak everything, you won't be able to be safe and nogc.

The only way out that I know of is an ownership system.


More information about the Digitalmars-d mailing list