Discussion Thread: DIP 1042--ProtoObject--Community Review Round 1

Timon Gehr timon.gehr at gmx.ch
Sun Jan 16 02:48:18 UTC 2022

On 1/15/22 13:02, Elronnd wrote:
> I will add: pure does not mean @safe.  The following program prints 17 
> on my computer with a recent dmd, for instance:
> pure int f(int *x) {
>      return x[1];
> }
> int main() {
>      import std.stdio;
>      int x, y = 17;
>      writeln(f(&x));
>      return y;
> }

About this, this is fine. `pure` has a meaning. In @system code it is up 
to the programmer to ensure this meaning is respected, where the 
language can provide some assistance with sane defaults. But in @safe 
code, it's on the language, with some assistance of @trusted assumptions.

More information about the Digitalmars-d mailing list