Sunday, 10 May 2015

The Preprocessor in Java

The Java language does not include a preprocessor. Much of the complexity of C and C++ can be traced back to the preprocessor. How many times have you read a C++ function and then needed to trace a
defined value or macro back through a hierarchy of headers in order to understand the function? The preprocessor brought a lot of flexibility to C and C++, but it also added artificial complexity.

Java's removal of the preprocessor means that you will need to unlearn a couple of old habits. For example, you will no longer be able to use typedef and #define. In Java, you would instead use classes and constants.  


No comments:

Post a Comment