1 matches bool, 2 matches long

Walter Bright newshound2 at digitalmars.com
Fri Apr 26 12:22:51 PDT 2013


On 4/26/2013 7:33 AM, deadalnix wrote:
> On Friday, 26 April 2013 at 08:00:28 UTC, Walter Bright wrote:
>> On 4/26/2013 12:07 AM, Maxim Fomin wrote:
>>> Regarding bool type as integer type is C atavism and should be abandoned.
>>
>> There's a very loooong history of 0 being regarded as false and 1 as true - it
>> goes well beyond C.
>>
>
> That is true, but even in theses elder languages, bool is handled as a special
> case, and not as an regular integral type. For instance, when integral
> conversion to smaller type is done by applying a mask (or doing a modulo, this
> is the same thing in this case) it is done by comparing to 0 to compare to bool.

I've also spent time with embedded systems that manipulated things by writing 
out 0's and 1's to ports, designed ABEL (a language for programming PLDs), and 
simply worked a lot with digital math.

0 and 1 being synonymous with false and true is deeply embedded. A bool is a one 
bit integer.

I remember once a language that tried to define true and false as something 
other than 1 and 0. It was horrible.


More information about the Digitalmars-d mailing list