Author Topic: cursor gets back to if statement after execution  (Read 3350 times)

gh43m

  • Guest
cursor gets back to if statement after execution
« on: November 20, 2012, 02:00:19 pm »
Dear friends,
I have written a code and executed it line by line. but when I execute an if statement, the condition is met and the line below if is executed, but the cursor comes back to "if" statement again.
why is this happening??
that part of code is here:

01     if(((sex=='f')||(sex=='F'))&&(age>30)&&(m_status=='s'))
02         bonus=base_salary*0.15;
03    else
04         ogholat=0;
05

I mean, when the condition is met(line 01), the cursor goes to line 2 and after calculation of bonus, it comes back to line 01 again. Of course after coming back to line 01, it jumps to line 5 and the program is working properly, but I am curious to find out why this is happening.
one of my friends told me that it comes back to take the address of line 05 (cuz there is else statement).
What's your idea??
Thanks in advance.


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: cursor gets back to if statement after execution
« Reply #1 on: November 20, 2012, 02:04:05 pm »
Probably some destructor is called. And this is a 'feature' of newer GDB's
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jarod42

  • Multiple posting newcomer
  • *
  • Posts: 87
Re: cursor gets back to if statement after execution
« Reply #2 on: November 20, 2012, 02:31:31 pm »
I'm agree with your friend:
the 'jump' statement may be associated to the 'if'.