On Saturday, 21 February 2015 at 20:13:26 UTC, deadalnix wrote:
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.
malloc+free can be trusted if wrapped in something like a ref
counted pointer, no?