@trusting generic functions

Lodovico Giaretta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 28 06:10:56 PDT 2016


On Saturday, 28 May 2016 at 13:03:10 UTC, Adam D. Ruppe wrote:
> What kind of pointer usage do you have? Remember that basic & 
> and * operations ARE @safe.
>
> If you have more internally, you might be able to wrap them up 
> in an @trusted function to again allow inference to work.

Ouch! I was under the impression that any pointer usage was 
forbidden in @safe code.

I have some structures holding pointers to other structures, and 
I'd like all of this structures being usable in @safe code. The 
problem of some structures being deallocated while others are 
holding pointers to them cannot exist in my scenario, so I'm sure 
that my code can be @trusted.

The only problem is that these structures are parameterized, and 
the type parameters may have unsafe operations that I use.


More information about the Digitalmars-d-learn mailing list