This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I recently upgraded from v4.2 to v5.1 and have been trying to build my projects on the new version. I noticed that I get a new error that I did not get on the previous version. Whenever I have a case where I set a variable equal to itself, ie target_position = target_position, I now get an error stating:
"Assignment to itself 'target_position = target_position'
Is there any compiler/linker option I can set to mitigate this? This has never been a problem with my code on the previous version and I don't really want to have to rewrite all my projects to account for this.
Thanks!
Dustin
Dustin,
This is not a compiler error, but instead an C-syntax error checker built into Eclipse. The syntax checker can be configured by right-clicking on the project --> Build Options --> click on Show Advanced Settings --> C/C++ General --> Code Analysis. It can also be completely disabled by going to the submenu Launching and then unchecking the box Run as you type (selected checkers).
However, I have a question: why are you assigning variables to themselves? Are you trying to establish points in your code to place breakpoints?
If so, you could also use the asm(" NOP");
That last option has one advantage: the optimizer (if used) leaves it alone.
Hope this helps,
Rafael
Rafael,
Thanks! That worked out well. As to your question, there are some places in my code where I write values to flash. To my understanding, each time I write to a flash block, I have to essentially re-write the entire block plus whatever addition I want to make. Under some circumstances I want to update a particular variable when writing to flash, but under other circumstances, I want to keep it the same. For the latter, there is some legacy code that simply sets a variable equal to itself to fulfill this task. This method seems to work fine and as it does, I didn't want to go back and create "copied" variables for all these occasions in past versions of the code unless I really needed to.
Thanks again,
Dustin