Go Down

Topic: Error when Using #define to set pins (Read 3603 times) previous topic - next topic

Coding Badly

I wonder if this would work if you set the compiler optimization off/to their lowest setting?

Yes.  With optimizations turned off the dead code is eliminated.  Oddly, a full stack frame is generated (which is dead code in my test case (but unrelated to the test)).

For example,

I suspect crippling bugs with the preprocessor can also be found.   ;)


Nov 26, 2012, 11:08 am Last Edit: Nov 26, 2012, 01:08 pm by pico Reason: 1

I suspect crippling bugs with the preprocessor can also be found.   ;)

Of course, but my point is that it is inherently a more difficult thing to accurately identify and eliminate dead code than it is to process text with preprocessing directives. I would _expect_ the dead code to be eliminated by a decent compiler, but without the same confidence I would have with the preprocessor.

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)


Nov 26, 2012, 06:38 pm Last Edit: Nov 26, 2012, 06:42 pm by tms8c8 Reason: 1
It's starting to make sense to me, now! Thanks again for all the help. I think I need to find some good text books that cover the basics of micro-controllers and IDEs/programming. I feel like my knowledge of the Arduino (both the IDE and hardware) is analogous to most people's knowledge of their car. They know how to drive it reasonably well and they have a conceptual understanding of how their engine and transmission work but that's it; they can't fix it if it quits. That's how I am on the Arduino - a lot of it is obscured by a black box of ignorance!


The good news it it's C/C++ witha few additions, so you'll find plenty of documentation for the language fundamentals.

Go Up