I had envisaged one of these in the project preferences
TESTING
= HOST
TESTING
= TARGET
TESTING
not defined at all
My problem is with the latter.
It seems that instead of
#if TESTING==HOST
#error "HOST defined" // add temporarilly for testing porpoises
#endif
I need to code
#ifdef TESTING
#if TESTING==HOST
#error "HOST defined" // add temporarilly for testing porpoises
#endif
#endif
I am convinced that this is not-standard behaviour, since if TESTING
is not defined then it certainly doesn't equal HOST
, and I do not need that extra #ifdef TESTING
with the GCC compiler.
However, when I use the Atmel AVR Studio (which I think is based on MS Visual Studio), it is necessary to add that initial #ifdef TESTING
in a few dozen places :-(
It looks like I have no choice, but I just wondered if any C standard acually requires this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…