Deprecate implicit `int` to `bool` conversion for integer literals

Temtaime temtaime at gmail.com
Sun Nov 12 16:04:59 UTC 2017


On Sunday, 12 November 2017 at 16:00:28 UTC, Ola Fosheim Grøstad 
wrote:
> On Sunday, 12 November 2017 at 13:34:50 UTC, Dmitry Olshansky 
> wrote:
>> if (a & (flag1 | flag2))
>>
>> to
>>
>> if ((a & (flag1 | flag2)) != 0)
>>
>> When the first is quite obvious.
>
> Just change the typing of the if-conditional to:
>
> if (boolean|integral) {…}

There's no force change.
if explicitly converts cond to bool.


More information about the Digitalmars-d mailing list