Getting action on your favorite D issues
ag0aep6g
anonymous at example.com
Sat Jun 6 15:16:06 UTC 2020
On 06.06.20 16:34, Avrina wrote:
> On Saturday, 6 June 2020 at 10:09:07 UTC, Patrick Schluter wrote:
[...]
>> Sorry, but undefined behaviour is undefined behaviour. The dmd code
>> generator is not at fault here.
>
> With statements like this I always feel like people don't understand
> what "undefined behavior" means.
I'm not so sure if you really understand what "undefined behavior" means.
By saying this:
> All the void initializer does is not initialize the memory of the bool.
you're defining the behavior of using void initialized values. Once you
do that, it's not undefined behavior anymore.
But the spec doesn't do that. Instead it says: "If a void initialized
variable's value is used before it is set, the behavior is undefined."
That is, the spec explicitly says that doing so is not allowed, and that
compilers may assume that it doesn't happen. Because that's what
"undefined behavior" means.
But Walter agrees with you: Using a void value shouldn't actually have
undefined behavior; it should just be an arbitrary value. Which is why
he has an open pull request to change the spec:
https://github.com/dlang/dlang.org/pull/2260
More information about the Digitalmars-d
mailing list