From: Rensburg R. <tra...@ya...> - 2002-08-21 18:37:35
|
I compiled the code below in Borland C vers.3.1 and it works fine. Exact same code in sdcc gives logically incorrect result. #include <stdio.h> char buf1[40] = "%GPRMS,180252,V,02520"; void testing (void) { int comma_counter; int y; comma_counter = 0; for (y = 0; y < 40; y++) { if (buf[y] == ',') comma_counter ++; if ((comma_counter == 1) && (buf[y] = ',')) uart_puti(y); if ((comma_counter == 2) && (buf[y] = ',')) uart_puti(y); } In borland it gives correct result namely first position of comma in buffer = 6 second position of comma = 13 But the above code in SDCC gives first comma position = 6 second comma position = 7 The 7 is logically incorrect. __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com |