1 matches bool, 2 matches long

Timon Gehr timon.gehr at gmx.ch
Sun Apr 28 05:14:23 PDT 2013


On 04/28/2013 11:05 AM, deadalnix wrote:
> On Saturday, 27 April 2013 at 21:52:30 UTC, Walter Bright wrote:
>> On 4/27/2013 2:29 PM, Rob T wrote:
>>> If bools are 1 bit ints, then why do we have 'true' and 'false' as
>>> keywords?
>>
>> Because writing cast(bool)0 and cast(bool)1 is unappealing.
>
> VRP say you don't need to.

void foo(bool b){ } // 1
void foo(int i){ }  // 2

void main(){
     foo(cast(bool)0); // calls 1
     foo(0);           // calls 2
}


More information about the Digitalmars-d mailing list