On Sunday, 27 December 2015 at 23:24:55 UTC, TheDGuy wrote:
On Sunday, 27 December 2015 at 22:51:27 UTC, Ali Çehreli wrote:
On 12/27/2015 07:53 AM, TheDGuy wrote:
Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8

YouTube says that the video has been removed by the user. That's exactly the reason why I don't like even dpaste. There is no guarantee that such threads will be useful forever. :) For me, sample code should be right here, and it should be short enough to practically be here.

Ali

I deleted the video because the problem was solved, it was neither a problem with the single '&' nor with my code it just showed a strange behaviour while debugging but the function returned the right value. Sample code is in my second post.

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 :)

Reply via email to