Simplification of @trusted
RazvanN
razvan.nitu1305 at gmail.com
Wed Jun 16 12:15:51 UTC 2021
On Wednesday, 16 June 2021 at 12:06:56 UTC, jmh530 wrote:
> 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.
I'm not sure what you are referring to. Whenever `a` is used
outside the trusted block, the compiler will apply the normal
safety constraints. When `a` will be used, the trusted block has
already been analyzed and any information regarding to it will be
present.
More information about the Digitalmars-d
mailing list