Preprocessor Directives
The C/C++ preprocessor provides an array of directives. In general, C++ practice is to use those directives designed to manage the compilation process and to avoid using directives as a substitute for code. For example, the #include directive is an essential component for managing program files. Other directives, such as #ifndef and #endif, let you control whether particular blocks of code get compiled. The #pragma directive lets you control compiler-specific compilation options. These all are useful, sometimes necessary, tools. You should exert caution, however, when it comes to the #define directive.
Use const Instead of #define to Define Constants
Symbolic constants make code more readable and maintainable. The constant's ...
Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.