Home Page - 2003-06-08

Post date: Nov 29, 2008 4:20:0 AM

The 'final' trick [Read this article]

Though Preprocessor macros are very useful for minimizing code typing and consistency, the key benefit of PP was to allow Conditional Compiling (CC). That is, some part of the code can be NOT compiled based on few conditions or 'flags'. This is the usual trick for cross-platform coding in C...

...if the inline keyword is just an hint to the compiler, why not make all these kinds of optimization a job of the compiler implementor?! Taking this idea to its limits, it can be said that a preprocessor can be made redundant, if we assume that the language is well defined, and these optimization can be guessed by the compiler more uniformly than the programmer.