Variable below zero but if statement doesn't grab?
rumbu via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Dec 28 08:15:56 PST 2015
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?
>> 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.
> 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:
void foo(int x)
if (x > 0) //step 1, correct
writeln("bigger"); //step 2, correct
writeln("lower"); //step 3, wrong
int main(string argv)
foo(20); //breakpoint with step in
If you really want to confuse the debugger, write some asserts or
contracts here and there and your program will be impossible to
More information about the Digitalmars-d-learn