Variable below zero but if statement doesn't grab?

TheDGuy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 28 13:54:37 PST 2015


> Get used to it :) Unfortunately, DMD is not emitting the best 
> debug information. The program flow is correct, but the line 
> info is not, that's why the execution step will not be 
> triggered in the real location of the source code.
>
> The simplest example is this:
>
> import std.stdio;
>
> void foo(int x)
> {
>     if (x > 0)              //step 1, correct
>     {
>         writeln("bigger");  //step 2, correct
>     }
>     else
>     {
>         writeln("lower");   //step 3, wrong
>     }
> }
>
> int main(string[] argv)
> {
>     foo(20);   //breakpoint with step in
>     return 0;
> }
>
> If you really want to confuse the debugger, write some asserts 
> or contracts here and there and your program will be impossible 
> to debug :)

So, do you have any information if there will be a fix to this? 
It is really hard (at least for me) to work with a language which 
doesn't feature a working debugger...


More information about the Digitalmars-d-learn mailing list