Simplification of @trusted

jmh530 john.michael.hall at gmail.com
Wed Jun 16 12:06:56 UTC 2021


On Wednesday, 16 June 2021 at 11:38:54 UTC, RazvanN wrote:
> [snip]
>
> ```d
> void foo() @safe
> {
>     @trusted
>     {
>         int[100] a = void;
>     }
>     ...
> }
> ```
>
> [snip]

The documentation related to these @trusted blocks should 
emphasize that the block should be large enough to encompass 
enough information to verify the safety of what would normally 
require the function to be labelled @system. For instance, in 
your above example, just void initializing is @system, but if you 
fill `a` later outside the @trusted block later, then it is 
harder to verify that it is actually @safe.


More information about the Digitalmars-d mailing list