Quantcast
Channel: Tools
Viewing all articles
Browse latest Browse all 91752

Forum Post: RE: FR5739 variables

$
0
0

[quote user="460822"]This is a serious problem.  Optimizing should not change the results for simple addition.[/quote]

No, it isn't a serious problem.  I think the best way to explain is by example.  Consider this code ...

void contrived_example(int input)
{
    int data = input + 1;
}

When you build that with optimization, the compiler will optimize that into an empty function.  Why?  Because data is a local variable.  The computation for data is not used anywhere else.  Eliminating the computation has no effect on the rest of the program.  Suppose you try to single step through this function.  That is going to be a bit awkward.  There is no code which corresponds to the data statement.

Your code is more complicated, but the principle still applies.  Since data is a local variable that is not referred to elsewhere, computations regarding it can be removed.  That makes single stepping those statements a bit confusing.

[quote user="460822"]how does one disable optimization using Code Composer 4?[/quote]

Highlight Basic Options, and you'll see the drop-down box for optimization level.

Thanks and regards,

-George


Viewing all articles
Browse latest Browse all 91752

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>