1 matches bool, 2 matches long
Jonathan M Davis
jmdavisProg at gmx.com
Fri Apr 26 15:28:28 PDT 2013
On Friday, April 26, 2013 14:14:55 Walter Bright wrote:
> On 4/26/2013 12:37 PM, Jonathan M Davis wrote:
> > There's nothing whatsoever about bool that
> > makes sense as an integral type.
>
> This is where our perspectives sharply diverge. A bool is a 1 bit integer
> type. Take a look at this, for example:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=9963
>
> Mathematically, they behave like 1 bit integers and are useful that way.
Sure, it may be useful sometimes to have code that treats true as 1 and false
as 0 for math, but I'd argue for casting being required for it, and in a large
number of cases, casting would be required already due to the fact that it
would be a narrowing conversion. But it seems very wrong to me that foo(1)
would call a bool overload or that "foo" ~ true would compile. There have been
a number of posts over time discussing bugs caused by that behavior being
legal. I don't think that it's a huge problem, but I do think that it's a
problem. However, we are clearly coming from very different points of view
here.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list