| ??? 01/27/03 01:45 Read: times |
#37365 - What's wrong with this C code? |
Hi,
void foo(unsigned char count) { while(count--) { /* do something here */ } } I compiled this on the Keil C251 V3.2 C compiler and it compiled the wrong code. I looked at the assembler output and at the beginning of the loop, it cleared count to 0 so that the loop never gets executed. Is what I did at the while-statement violated some ANSI no-nos or something? This, while(count) { count--; /* do something here */ } however, compiled the correct code. Andy |
| Topic | Author | Date |
| What's wrong with this C code? | 01/01/70 00:00 | |
| RE: What's wrong with this C code? | 01/01/70 00:00 | |
| RE: What's wrong with this C code? | 01/01/70 00:00 | |
| RE: What\'s wrong with this C code? | 01/01/70 00:00 | |
RE: What\'s wrong with this C code? | 01/01/70 00:00 |



