CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

how to convert hexadecimal into decimal string
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pilar



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

PostPosted: Thu Aug 06, 2009 10:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 07, 2009 2:20 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 07, 2009 3:07 pm     Reply with quote

Wayne, thank by your help...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group