Bug? 0 is less than -10
Marc Schütz via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 7 09:25:01 PDT 2015
On Tuesday, 6 October 2015 at 14:46:56 UTC, tcak wrote:
> Maybe I am just too stressed out to see the problem.
>
> [code]
> import std.stdio;
>
> void main(){
> size_t dec = 0;
>
> writeln( dec, " ", (dec <= -10), " ", (dec >= 10), " ", ((dec
> <= -10) || (dec >= 10)) );
> }
> [/code]
>
> [output]
> 0 true false true
> [/output]
>
> How is it generating "true" for (dec <= -10) ? Is there a
> special casting or something?
>
> DMD 2.068.2, Ubuntu 64-bit
Lionello Lunesu posted a PR that should fix this:
https://github.com/D-Programming-Language/dmd/pull/1913
See also the discussion in the linked bug report.
Unfortunately it seems it's been forgotten since then...
More information about the Digitalmars-d-learn
mailing list