[Issue 21565] @safe code allows modification of a scalar that overlaps with a pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 21 19:12:33 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21565

--- Comment #14 from Paul Backus <snarwin+bugzilla at gmail.com> ---
(In reply to Steven Schveighoffer from comment #12)
> 
> On the grounds that it's not desirable. It does not cause undefined
> behavior, just useless behavior. We are better off disallowing it.

"I don't like it" is not a technical argument, and should have no place in a
technical discussion.

> What does this mean? All individual values are safe according to D.

If you really believe this, then you do not understand D's memory-safety system
well enough to contribute usefully to this discussion, and I am wasting both my
time and yours by continuing to respond.

> It's not about being @safe or not. That's why I said the rules are sound.
> It's just that the rules leave us with the reality that using such unions
> usable in @safe or @trusted code has no utility.

If it's "not about being @safe or not", then what on Earth *is* it about?

Personally, I think @safe should allow all code that the compiler can prove is
memory-safe, regardless of whether you, I, or anyone else thinks it "has
utility" or not. I am rather surprised that this is a controversial point of
view.

--


More information about the Digitalmars-d-bugs mailing list