1 matches bool, 2 matches long

Robert Schadek realburner at gmx.de
Fri Apr 26 05:01:46 PDT 2013


On 04/26/2013 07:02 AM, Walter Bright wrote:
> A bool is an integer with the range 0..1
This is True for the type but for the actual code it looks different.
There 0 == false. and everything else is true.

import std.stdio;
void main() {
    if(10) {
        writefln("%d is also true", 10);
   }
}

if(value) proberly becomes:
    cmp value, 0
    jne ifblock

Anyway, I think no implicit casts would be wonderful, sure everybody
would hate it at first but than...


More information about the Digitalmars-d mailing list