a design flaw in DIP1035, its remedy, and the implication for @system variables
Nick Treleaven
nick at geany.org
Wed Apr 13 14:02:37 UTC 2022
On Wednesday, 13 April 2022 at 12:14:53 UTC, Zach Tollen wrote:
> ```d
> extern int* x;
> @system int y;
>
> void fn() @safe {
> x = new int; // error: unsafely initialized variable `x`
> cannot be accessed
> // in @safe code - try marking its
> declaration @trusted?
That would encourage people to use trusted even when it is
actually an unsafe value.
...
> They should have forced the user then and there to say whether
> it was `@trusted` or `@system`.
That would break existing code. @system is a good default for
extern (C) unsafe globals and functions, even if we make D @safe
by default.
More information about the Digitalmars-d
mailing list