Discussion Thread: DIP 1035-- at system Variables--Community Review Round 1
Stanislav Blinov
stanislav.blinov at gmail.com
Wed Jun 10 15:56:06 UTC 2020
On Wednesday, 10 June 2020 at 14:20:37 UTC, Dennis wrote:
> On Wednesday, 10 June 2020 at 12:36:13 UTC, Stanislav Blinov
> wrote:
>> As before, that last line is not memory corruption, it's UB.
>
> Each example has two consecutive moments:
> A) Memory gets in a state that violates the programmer's
> intended invariants.
> B) Because of that, immutable memory is mutated, or memory
> outside a pointer's allocated block is accessed.
>
> If I understand correctly, you claim that A) should be called
> memory corruption and B) is undefined behavior, while I call B)
> memory corruption. In the D specification, corrupting memory is
> undefined behavior, and undefined behavior can manifest in
> memory corruption, so when talking about @safe the terms are
> sometimes used interchangeably.
Memory corruption is undefined behavior, but undefined behavior
is not memory corruption. The former is a subset of the latter,
they're not equivalent, and so should not be used
interchangeably. BUT, so far as those comments in examples are
concerned, I do stand corrected regardless (should've consulted a
dictionary beforehand), since "corruption" can refer both to
corrupting and being corrupt(ed). Apologies.
More information about the Digitalmars-d
mailing list