Yes, a smart optimizing compiler won't bother generating any machine code that increments the variables, because it already knows their final values.
If you don't use x and y later in your program, then a smart compiler will remove all the machine code and memory storage for those variables, because they do no useful work.
I don't know how smart your 8051 compiler is. Maybe it optimizes some things but not others. That would explain the unexpected behavior you see in the debugger.
Try doing something useful with x and y, so the compiler can't just throw them away.
unsigned int and unsigned mean the same thing. I changed it by habit, without realizing that I had done it!
Do you have smart 8051 compiler can you send the installer to my mail (tangbc05@yahoo.com)..please.., may be my compiller is not full version...
Can you give example code for this because i still not understand very well "Try doing something useful with x and y, so the compiler can't just throw them away". Thank for your help....
Oh. Your 8051 compiler doesn't support printf(). I understand.
Time delay? Is that why you are writing loops that do nothing? Software delay loops can be very unpredictable, as you have seen! You should use the 8051's hardware timer. I don't know how to do that, but I'm sure there are other messages on this board.
Oh. Your 8051 compiler doesn't support printf(). I understand.
Time delay? Is that why you are writing loops that do nothing? Software delay loops can be very unpredictable, as you have seen! You should use the 8051's hardware timer. I don't know how to do that, but I'm sure there are other messages on this board.