bool <=> int. WTF. (DIP0015)

Patrick Schluter Patrick.Schluter at bbox.fr
Fri Jul 5 09:04:26 UTC 2019


On Friday, 5 July 2019 at 03:10:06 UTC, Exil wrote:
> On Thursday, 4 July 2019 at 16:31:11 UTC, Patrick Schluter 
> wrote:
>> that's the issue. D's bool type follows exactly C (C has bool 
>> since C99) and C++ way.
>> bool b; will behave exactly like your bool b = void;
>
> It doesn't have the same behavior. Currently DMD's codegen is 
> bad, sometimes it checks the entire byte value and other times 
> it only checks the first bit. All C/C++ compilers I've used 
> check the entire value, consistently.

if the codegen does something like (x & 1) then it is indeed a 
BUG and should be corrected.


More information about the Digitalmars-d mailing list