Why do some T.init evaluate to true while others to false?
ArturG via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 27 08:49:16 PDT 2016
On Friday, 27 May 2016 at 15:24:18 UTC, Adam D. Ruppe wrote:
> On Friday, 27 May 2016 at 15:19:50 UTC, ArturG wrote:
>> yes but i have to check for that when some one does
>
> Why? This is no different than if they set any of the other
> four billion possible values.
What do you mean?
operation on float.nan gives you a float.nan so why does the
shortcut evaluate to true and not false wouldnt that make more
sense?
float f;
if(f) "why does this print".writeln; // it should not
same for char
char c;
if(c) "why does this print".writeln; // it should not
it works for most other types is there any reason why it doesnt
work or couldnt work with floating points and character types?
More information about the Digitalmars-d-learn
mailing list