DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement

Isaac S. spam-no-reply-isaac at outlook.com
Tue Nov 13 00:07:36 UTC 2018


On Monday, 12 November 2018 at 21:29:20 UTC, Walter Bright wrote:
> *snip*
>
> In my college daze I was learning programming alongside 
> designing and building digital circuits, and later software for 
> FPGAs and PLDs (ABEL). The notions of True, T, 1, !0 (from C 
> and Asm), and +5V are all completely interchangeable in my mind.
>
> *snip*

Well if we're talking about code smell: I would regard any code 
that expects true to be the same as 1 a code smell (I've 
interacted with C++ code that uses integers instead of bools and 
it's annoying and hard to read).

There's a reason I use
const foo = boolValue ? otherValue : 0;
and not
const foo = otherValue * boolValue;
because it shows _intent_.

I think the rest of us would like to hear an actual justification 
for bool being an "integer" type.


More information about the Digitalmars-d-announce mailing list