Yeah, I spent an hour chasing down that one, too. A macro like this has three states:
Code:
#ifdef ENABLE_SERIAL_PORT_ONE_TX
The states are "true," "false," and "the programmer forgot to define it". By using the #ifdef approach, the last two states are equivalent, so the compiler can't help you.
That's why I prefer using
Code:
#if ENABLE_SERIAL_PORT_ONE_TX
where the macro value is '1' for enabled and '0' for disabled. If the programmer doesn't #define it to
one of those values, the compiler will complain, and an hour is saved!
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the
USPTO.
My favorite error message from gcc:
main is usually a function
My favorite error message from Windows:
There is not enough disk space available to delete this file.