| View previous topic :: View next topic |
| Author |
Message |
pilar
Joined: 30 Jan 2008 Posts: 197
|
|
Posted: Thu Aug 06, 2009 10:15 am |
|
|
| in my debuger I see that CPU doen not execute the comparison and jump to the next instruction |
|
 |
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Fri Aug 07, 2009 2:20 am |
|
|
This can be very missleading.
You have not posted a complete program, you do NOT show the declaration and initialisation of Alarm, there is a lot of info missing which may explain why the debugger LOOKS like it is not doing the if statement.
Usually, because the compiler has optimised the code and for instance in your program if the second assignment is redundant the compiler will leave it off e.g.
| Code: |
int alarm;
char str1[] = "test";
char str2[] = "fail";
alarm = 0;
if (strcmp(str1, str2) == 0)
alarm = 1;
else
alarm = 0; // This is not required as alarm is already set to 0 just before the if statement.
// So if the condition is false the debugeer should just jump to the next line of code after this.
|
I am not saying for sure that the CCS compiler has done this, the easiest way to find out what is happening is to examine ALL of the strings in the statement at the time the statement is to be executed. I am sure I asked you to post this info!
Another option is to switch to assembler mode and step through that! I am sure you can do it with CCS.
Or examine the .lst file to see what has actually been compiled at that point! You could also post that snippit of code!
I can't actually check these things at the moment!
Anyway, you can either post more info which will help us solve this problem including a complete test program!
You also don't say if you tried any on my sugestions. |
|
 |
pilar
Joined: 30 Jan 2008 Posts: 197
|
|
Posted: Fri Aug 07, 2009 3:07 pm |
|
|
| Wayne, thank by your help... |
|
 |
|