Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

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.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap