Help
Advanced Member level 2
Re: C code
Hai..
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....
My code is that simple:
Is it any problem to my code....
Thank You..
echo47 said: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!
Hai..
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....
My code is that simple:
Code:
#include <reg52.h>
void main(void)
{
while(1)
{
unsigned int x, y;
for(x=0; x<=3; x++)
{
for(y=0; y<=120; y++);
}
}
}
Is it any problem to my code....
Thank You..