1 open project HELLO 2 insert int e,b,c; after main 3 in project devce select extended linker 4 translate 5 debug and see that variable e ????? what is it? is it new version?
I did as you suggested and I receive the following compiler warnings:
*** WARNING C280 IN LINE 24 OF HELLO.C: 'e': unreferenced local variable *** WARNING C280 IN LINE 24 OF HELLO.C: 'b': unreferenced local variable *** WARNING C280 IN LINE 24 OF HELLO.C: 'c': unreferenced local variable
for example add line e=10; and you will see the same question ???? e-> ??????? what is it ;-)
Please send me your c and uv2 file a don't to achieve your results so I probe with your files. holatron@seznam.cz
send mail for you
If you assign a value to a variable and never use the variable anywhere else, what should the compiler do? Should it optimize this out or not? If you don't want the compiler to optimize out useless code, set the optimizer level to 0. Then, you will be happy. Of course, the code generated will be unoptimized. Jon
If you assign a value to a variable and never use the variable anywhere else, what should the compiler do? Should it optimize this out or not? To answer the rhetorical question: Depends on whether the variable is declared volatile or not. If it's volatile, then there are perhaps side effects from the write -- say if it's a hardware register -- and you need to keep the assignment. If not, optimize away. So, if you're bent on keeping the variable e in the program, make sure to do something with it. Printf() it. Use it as a loop counter. Something, just to give it a reason to exist. Or just declare it volatile.
special for you insert e=0; e=e=10; and write e you will have same effect æ-)))
sorry e=e+10;
View all questions in Keil forum