The following are some guidelines for using and not using the preprocessor effectively:
- If you can write a function in C, do that instead of using a preprocessor macro.
You may also want to consider the use of the inline C declaration. inline provides a suggestion to the compiler to place the body of the function wherever it is called as if a textual substitution were done. This has the advantage of preserving all of the type checking, as well as eliminating the overhead of a function call.inline becomes useful in very high-performance programming situations. - Use the preprocessor as a last resort for performance. Eliminating statements or function calls as a means of improving performance is known as central processing unit (CPU) cycle trimming and is highly subject to even minor variations in system configurations. Therefore, strive to pick the best, most efficient algorithm before resorting to cycle trimming. ...