[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 17:23:01 UTC 2021


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

--- Comment #10 from Steven Schveighoffer <schveiguy at gmail.com> ---
(In reply to Paul Backus from comment #9)
> > I'm disagreeing with the ability of safe code to access any part of this.
> 
> On what grounds? The point of @safe is to prevent undefined behavior, and
> allowing access to the integer cannot possibly lead to undefined behavior,
> because all integer values are safe values.

Read-only access is fine. Write access is not.

> 
> > the current rules are sound, just nonsensical. It makes such unions pointless when writing safe code.
> 
> I agree--which is why I would like to replace them with rules that are both
> sound *and* sensical. Can we agree that that's a desirable goal?

I can't say no to the agreement ;) I just don't know what the definition of
"sensical" means, based on your prior messages. What rules do you have in mind?

--


More information about the Digitalmars-d-bugs mailing list