Arrays of structs
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Aug 27 04:45:13 PDT 2015
On Thursday 27 August 2015 13:15, BBasile wrote:
> https://github.com/BBasile/iz/blob/master/import/iz/types.d#L125
> https://github.com/BBasile/iz/blob/master/import/iz/types.d#L150
> https://github.com/BBasile/iz/blob/master/import/iz/types.d#L191
Your use of @trusted is wrong and dangerous. @trusted functions are supposed
to be memory-safe, but you're marking unsafe functions with it.
Things like a @trusted `free` [1] are just plain wrong. `free` isn't memory-
safe.
The problems with @trusted templates can be more subtle. Even if the
template body itself doesn't do anything unsafe, the template arguments are
being trusted, too. So if the template ever calls any code from the
arguments (including constructors, destructors, postblits, ...), then it
cannot be marked @trusted.
[1] https://github.com/BBasile/iz/blob/master/import/iz/types.d#L112
More information about the Digitalmars-d-learn
mailing list