C51 version 7.09
a = LEFT ; switch (a) { case LEFT : subproA P1 = 0x01; P1 = 0x01; subproA break; case RIGHT : subproB P1 = 0x01; P1 = 0x01; subproB break; default : somethingjob; }
You have provided an example which cannot be compiled. You have not provided the assembler listing for the code in question. Without more information, it's impossible for anyone to help you with this. Jon
"it is like not going to default place after all case comment" That is correct operation for a 'C' switch statement!
Have you looked at the generated assembly with and without optimization? The double assignment to P1 that is common to both branches of the case might be optimized into a single bit of code. (Since "subproA" and "subproB" are not syntactically correct C, it's obvious you've abstracted the actual code. So it's hard to tell exactly what's going on. Be sure you haven't omitted any details or inavertently corrected a problem in transforming the original structure to a post.)