Can we just have struct inheritence already?
Timon Gehr
timon.gehr at gmx.ch
Thu Jun 13 21:23:27 UTC 2019
On 13.06.19 23:10, Tim wrote:
> On Thursday, 13 June 2019 at 20:55:34 UTC, Exil wrote:
>> This problem happens because you are used @trusted. If you used @safe
>> you wouldn't be able to increment pointers and modify the values the
>> way you did in @trusted.
>
> The @trusted function behaves correctly if it receives valid input. The
> memory corruption only happens, because the @safe function passes a
> value, that is not expected by the compiler.
Basically, it could be argued that `void` initialization of a `bool`
variable is already memory corruption. It's indistinguishable from
someone holding a dangling `char*` to your `bool` memory and then
writing a value other than '\0' or '\xff'.
More information about the Digitalmars-d
mailing list