operator "~" does not check type?
deadalnix
deadalnix at gmail.com
Wed Oct 12 06:31:05 PDT 2011
Le 12/10/2011 09:53, bearophile a écrit :
> Jonathan M Davis:
>
>> int and dchar implicitly convert to one another for better or for worse.
>> Personally, I'd prefer that they didn't, but that's the way that it is, so I
>> don't believe that this is technically a bug.
>
> char->int is OK, but int->char is not so OK. This programs (that compiles with no errors) seems to show a possible source of bugs, so I call this a design bug, worth fixing:
>
In D, the conversion is implicit if the compiler can detect it is same
via bound checking. Here, the compiler can deduce that the int 10 is
between 10 and 10 so can be safely converted.
More information about the Digitalmars-d-learn
mailing list