Getting action on your favorite D issues
Avrina
avrina12309412342 at gmail.com
Sat Jun 6 14:34:11 UTC 2020
On Saturday, 6 June 2020 at 10:09:07 UTC, Patrick Schluter wrote:
> On Friday, 5 June 2020 at 23:53:28 UTC, H. S. Teoh wrote:
>> Output:
>> -----------------
>> dead
>> -----------------
>>
>> Truly, DMD's backend is in the bright future of strange and
>> wonderful quantum effects, whereas LDC is clearly still stuck
>> in the antiquated classical past. ;-)
>>
> 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.
All the void initializer does is not initialize the memory of the
bool. DMD is testing more than a single bit for a type that is
only a single bit, it flip flops between testing a byte and
testing a bit. That is most definitely a bug in the DMD backend.
Just to bring up an old debate, this has been argued to not be a
bug and is defined behavior and *will not* be changed.
void foo(bool);
void foo(byte);
foo(0); // calls bool
foo(1); // calls bool
foo(2); // calls byte
More information about the Digitalmars-d
mailing list