Thu, 24 May 2007
Preprocessor abuse : chapter 2 of lots.
Those who program C are used to seeing function / subroutine definitions in header files. Not so in Fortran, there people use the C pre-processor to put Header files in subroutine definitions.
Don't try this at home, folks.
Again, names changed to protect the afflicted ...
subroutine funmame( param1, param2, param3, #ifdef FOO32 foo, bar, #endif param7, param8, #include "basarg.h" )
Remarkably, basarg.h included:
C Comment.
param5, param6,
#ifdef SOMETHING
param10, param20,
#endif
There were in fact dozens of parameters in basarg.h.. And even a higher.h that included basarg.h but had more parameters ...
Some years ago though, when I was obliged to maintain a Linux setup for a cluster and its different headnodes using Kickstart (yes, RedHat 7.2), I did something similar: create all the individual files from a master file using -Defines and cpp... almost forgotten about that, after 3 years of FAI :-) I'll never go back!!!
Posted by Steffen Grunewald at Thu May 24 16:48:36 2007