Interview Questions

A third-party header file I just started using is defining its own TRUE and FALSE values incompatibly

C Interview Questions and Answers


(Continued from previous question...)

A third-party header file I just started using is defining its own TRUE and FALSE values incompatibly

Q: A third-party header file I just started using is defining its own TRUE and FALSE values incompatibly with the code I've already developed. What can I do?

A: This is indeed an annoying situation. It's a classic namespace problem;Ideally, third-party vendors would be conscientious when defining symbols (both preprocessor #defines and global variable and function names) to assure that namespace collisions were unlikely. The best solution is to get the vendor(s) to fix their header files.
As a workaround, you can sometimes undefine or redefine the offending macros between the conflicting #include directives.

(Continued on next question...)

Other Interview Questions