1 matches bool, 2 matches long

Mehrdad wfunction at hotmail.com
Sat Apr 27 13:31:13 PDT 2013


On Saturday, 27 April 2013 at 19:51:48 UTC, Walter Bright 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).


The problem is 'bool' has *NOTHING* in common with integers!

- Can't use + - * / << >> on bool's
- (bool)2 == (bool)1  (do you SERIOUSLY think this is 
integer-like?)
- sizeof(int64) == 8 * sizeof(int8)
- sizeof(int8 ) != 8 * sizeof(bool)


There is literally _NOTHING_ about bool that's integer-like, and 
for some reason you still think bool is an integer.

And you still wonder why people find D frustrating?


> An analogous issue comes up here now and then about 'char' and 
> characters.

That was a C++ mistake, I hope you're not trying to repeat it.

Heck, even in C++, you can make sense out of it if you stick with 
the convention:

- "char" == character
- "unsigned char" == ubyte
- "signed char" == sbyte


More information about the Digitalmars-d mailing list