A streamlined preprocessor written in Fortran

Thanks for the extensive response and advice. I began some serious projects in Fortran several years ago with the initial goal of full-standard compliance. But soon it became clear to me that it is not possible in any efficient manageable way (not that it is a limitation of Fortran. Any language without preprocessing capabilities would present the same challenges). For example, one project involves three implementations (serial, Coarray, and MPI parallelism). Although MPI and some existing Coarray implementations are consistent with each other and can be mixed, it is completely illogical to combine the two in this particular case. But duplicating the entire code base for each paradigm is also nonsensical. The only resolution was to use conditional compilation. Fortunately, the preprocessing features of some compilers are partially consistent with each other, like those of Intel and GNU. But it would be great if these features were standardized so that users know what can be relied upon and what is portable across standard-conforming compilers. I am generally hesitant of using external community-driven preprocessors, especially if it written in some other non-Fortran language. Even though they may be super-beneficial from the developer’s perspective, they generally add a layer of dependency which can complicate and lengthen the build process for the end-users and be a barrier toward full automation of the library build.

4 Likes