advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Which other techniques would you recommend for minimizing platform-dependencies in C++ projects? Let us know in our C++ Discussion Forum.
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
Average Rating: 3/5 | Rate this item | 6 users have rated this item.
 

Use Conditional Compilation to Hide Platform Dependencies and Implement #include Guards

Though many languages have long since disposed of their preprocessors, in C++ it is still an indispensable tool for source file management and cross-platform development. This solution shows how you can use the preprocessor to perform conditional compilation.  


advertisement
he C++ preprocessor may seem like a prehistoric relic that has no place in state-of-the-art C++ projects, but this isn't really so. Although every beginner nowadays knows how to use inline functions and const variables instead of #define macros, the preprocessor is still an indispensable tool when it comes to source file management and cross-platform development.


How can you avoid multiple inclusions of the same header file during a compilation session? How can you overcome platform-dependencies in a large-scale project?


Use the preprocessor to perform conditional compilation.

  Next Page: Demonstrating the Problem
Page 1: IntroductionPage 3: Conditional Compilation and Cross-platform Development
Page 2: Demonstrating the Problem 
Please rate this item (5=best)
 1  2  3  4  5
advertisement