1 matches bool, 2 matches long

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 29 09:54:40 PDT 2013


On Sat, 27 Apr 2013 12:51:48 -0700, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 4/26/2013 7:36 PM, Mehrdad wrote:
>> Walter, you're completely missing the point.
>
> I completely understand it is a perception problem. Some people see bool  
> as a 1 bit integer (including me). Some see bool as something very  
> distinct from integers (including you).

short x = cast(short)0x10000;
assert(x == 0);

bool b = cast(bool)2;
assert(b == 1);  // NOT 2s complement

bool is not an integer.  It doesn't behave like any other integer type.   
Because it has some power to implicitly cast to int, this does not make it  
an integer.

-Steve


More information about the Digitalmars-d mailing list