On Monday, April 29, 2013 09:54:40 Steven Schveighoffer wrote: > On Sat, 27 Apr 2013 12:51:48 -0700, Walter Bright > > <[email protected]> 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.
It also isn't considered to be an integral type per std.traits.isIntegral. isIntegral only considers byte, ubyte, short, ushort, int, uint, long, and ulong to be integral types. - Jonathan M Davis
