While I was writing some code for the keyboard interrupt handler, I noticed a strange fact that I cannot explain: whether I inserted a 'if' block or not, the assembly file generated by the compiler were exactly the same. I have cut the code so that it shortly explain the misbehaviour. Here it is.
Code: Select all
1
2
3 char upcase;
4
5
6 int kbd_h(char c)
7 {
8
9 if (c == 170 || c == 182) {
10 upcase = 0;
11 return 0;
12 }
13
14 if (c == 42 || c == 54) {
15 upcase = 1;
16 return 0;
17 }
18
19
20 return 0;
21 }
I use gcc version 4.5.2, the default from my Slackware Linux installation. It's not the latest release, but it's quite recent. Other compilers, (like pcc), output different code.
Could anyone reproduce this misbehaviour? Is there something I did wrong?
Thank you for any advice.
P.S.: Please forgive me for my bad English. It isn't my mother tongue.