An exegesis of Walter's reference counted slice

via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 24 12:53:07 PST 2015


On Tuesday, 24 February 2015 at 19:40:35 UTC, Andrei Alexandrescu 
wrote:
> I modified Walter's sample code to this: 
> http://dpaste.dzfl.pl/f3d854feede9. It uses malloc for both the 
> array and the reference count, and also uses @trusted 
> minimally. I inserted assert()s here and there to clarify the 
> workings. Nothing big except for the careful use of @trusted.

Doesn't look like it follows the "philosophy behind" @trusted.

Conceptually, you should be able to insert exceptions everywhere 
outside the called @trusted function and retain memory safety. 
The way the code is written you have to move outside the @trusted 
function to prove memory safety.


More information about the Digitalmars-d mailing list