setting breakpoints don´t work correctly - it turn to next lines - why?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

setting breakpoints don´t work correctly - it turn to next lines - why?

450 Views
alexandrevdp
Contributor I

01 for(i=0;i<var;var++)

02 {

03     a= 0;    I put breakpoint here and the codewarrior put on line 05. Why? How can I fix this on debug window of codewarrior 10.6

04     b = 0;

05     c =0;

06 }

Labels (1)
0 Kudos
2 Replies

362 Views
BlackNight
NXP Employee
NXP Employee

Hello Alexandre,

that very much depends on optimizations and how/where you have the variables a, b and c. If they are local variables for example, the compiler will see that they are only written once with zero and never change. For 'bad' code like this the debug exprience will be bad too. You can prevent the compiler optimization with disabling the optimizations or mark the variables with 'volatile' keyword.

Erich

0 Kudos

362 Views
alexandrevdp
Contributor I

Thank you very much!! I will try this

0 Kudos