We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When I write a simple switch case program: ----------source:
void main() { char e = 0; int a=0; int b=2; int c=3; switch(e) { case 1: a = a + b; break; case 2: a = a + c; break; default: break; } }
But,the c51 complier generates:
... 4: void main() 5: { 6: char e = 0; 7: C:0x000F E4 CLR A 8: int a=0; 9: int b=2; 10: int c=3; 11: switch(e) C:0x0010 24FE ADD A,#0xFE C:0x0012 6002 JZ C:0016 C:0x0014 04 INC A 12: { 13: case 1: 14: a = a + b; 15: break; C:0x0015 22 RET 16: case 2: C:0x0016 22 RET C:0x0017 00 NOP C:0x0018 00 NOP C:0x0019 00 NOP ...
How could it be possible?
Looking at a manual for a totally different compiler for a totally different architecture probably isn't too helpful - especially when the correct manual is readily to hand:
http://www.keil.com/support/man/docs/c51/c51_optimize.htm
Note also the Related Knowledgebase Articles linked at the bottom of the page...