iofortrancommand-line-argumentsfortran77

Standard conforming way to get command line arguments in FORTRAN77


The gcc manual mentions getarg as a gnu extension. It seems to be supported by many compilers (i.e. the rather strict f2c also understands it). But getarg is not mentioned in the FORTRAN77 standard. So is/was there any standard conforming way to get command line arguments in FORTRAN77?


Solution

  • No there are no features for this in standard FORTRAN 77. This kind of interaction with the operating system is not covered in the ancient FORTRAN 77 standard and must be done using extensions to the standard or using standard features from Fortran 2003 as in How to use command line arguments in Fortran?.

    I realized that the exact formulation of your question was rather "So is/was there any standard conforming way to get command line arguments in FORTRAN77?". This opens way to discussion what exactly is and is not standard conforming and involves subtleties you may not have originally in mind when originally asking.

    I agree that extensions, especially additional intrinsic procedures, are allowed by the standard and hence calling them does not make any FORTRAN 77 program not standard conforming. My point was that the standard itself does not offer any such features and the extensions are not standardized and can be different in different processors.

    Similarly, a FORTRAN 77 program calling an external library written in another language or directly in the processor's machine code or assembly is still perfectly legal FORTRAN 77 program. It is just not a program that only uses features available in FORTRAN 77.