gfortran question about optional subroutine arguments

Tim Prince
Thu Mar 14 13:39:00 GMT 2013

On 3/14/2013 8:30 AM, Tobias Burnus wrote:
> Mark Hounschell wrote:
>> c    the old fortran77 call would have been
>> c    call sub1(arg1,)
> Hmm, I have not seen the ",)" syntax before. I assume that that is 
> some vendor extension, where the compiler does something - or a typo 
> and it should be "arg1)" without ",".
I think I recall something like this from long before the f77 days.   
With certain compilers, this resembled optional argument, although it 
may have passed a machine zero value (and reserved a safe slot for 
discarding a returned value).  Certainly, there is no way for 
-std=legacy to know which prehistoric compiler you wish to emulate. g77 
had a variety of optional argument scheme which worked differently from 
this, but I don't think anyone made a case for continuing it in 
gfortran.  f90 requires a compiler to complain about such non-standard 
usage, and to use explicit interface for optional arguments.

Tim Prince

More information about the Gcc-help mailing list