1

How should a C compiler handle a #else directive that corresponds to a #ifdef directive inside another #ifdef that evaluates to false? In other, words in the code below should code C get executed because the compiler thinks the #else corresponds with the first #ifdef? Or should it be 'smart' enough to know that all of the 2nd #ifdef is nested inside the false evaluation of the 1st #ifdef?

#undefine FLAG1

#ifdef FLAG1
//code section 1
#ifdef FLAG2
//code section 2
#else
//code section 3
#endif
#endif
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Mr. Gravy
  • 23
  • 4

0 Answers0