enforce (i > 0) for i = int.min does not throw

kdevel kdevel at vogtner.de
Sat Jan 27 15:16:48 UTC 2018


On Saturday, 27 January 2018 at 14:49:52 UTC, Ali Çehreli wrote:
> But enforce is a red herring there. This prints true with 2.078 
> as well:
>
> import std.stdio;
>
> void main ()
> {
>     int i = int.min;
>     writeln(i > 0);    // prints 'true' with 2.078
> }

test.d
---
import std.stdio;
void main ()
{
    int i = int.min;
    auto b = i > 0;
    b.writeln;
    auto c = int.min > 0;
    c.writeln;
}
---
$ dmd test.d
$ ./test
true
false



More information about the Digitalmars-d-learn mailing list