A streamlined preprocessor written in Fortran

I know this topic is hotly debated and disliked by the Fortran committee. But it would have been great if the committee took the issue of a Fortran preprocessor more seriously. If there are so many users actively using it, to the extent that they have to create new preprocessors for their needs, and if all major compilers support some form of preprocessor that is heavily used by the Fortran programmers (including the committee members), that is really pointing to some gap in the language.

One major application of preprocessor that will not be resolved even when templates become part of Fortran, is the issue of code sections that belong to a particular platform or parallelism paradigm. Let’s agree with the committee’s consensus that the use of preprocessor encourages bad programming habits. What is the alternative in such use cases that I mentioned? Code duplication? My comment here is more of a request for help than attempting to argue for the usefulness of preprocessor. The question is whether the benefits of standard preprocessor recognized by all compilers outweigh the drawbacks.

8 Likes