On 14.04.22 13:42, wjoe wrote:
Undefined behavior yes, but regardless the example proves it can be done
in @system code.
A few versions ago, possibly due to a bug or regression, the compiler
didn't complain in @safe code either.
Of course you are correct academically. However, since it's possible,
I'd wager my last hat that code like this is out in the wild.
No, it cannot be done in @system code. The example only proves that you
can write nonsense code that has no defined meaning.
Note that the nonsense you wrote behaves as you describe only in
Windows. Elsewhere, you get a segfault.
But it doesn't matter how the executable actually behaves. You cannot
cite the result of undefined behavior when arguing language semantics.