SUBROUTINE subr_name(arg1,arg2,arg3)
:
END SUBROUTINE
END MODULE
The F95 standard, g95 and the Lahey compiler do not allow this mixture
of function and subroutine in the generic interface. On the other hand
gfortran and Intel Fortran compile it and run it successfully.
Who is right? Has the standard changed since F95?
Thank you in advance,
/Sakis
> The F95 standard, g95 and the Lahey compiler do not allow this mixture
> of function and subroutine in the generic interface. On the other hand
> gfortran and Intel Fortran compile it and run it successfully.
>
> Who is right? Has the standard changed since F95?
F2003, 16.2.3
"Within a scoping unit, two procedures that have the same generic name
shall both be subroutines or both be functions..."
Pretty straightforward as standard-speak goes. I don't recall these
words as changing much between f90 and f2003.
Note that it is not a constraint, so compilers are not required to
diagnose the error. That means that all of the compilers are "right" in
some sense; allowing this would be an extension rather than an error in
teh compiler.
That being said, at least a warning would be nice, even if not required
by the standard. Have you tried turning on warnings for nonstandard
features in gfortran and Intel?
--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
> Athanasios Migdalas <sa...@otenet.gr> wrote:
>
>> The F95 standard, g95 and the Lahey compiler do not allow this
mixture
>> of function and subroutine in the generic interface. On the other
hand
>> gfortran and Intel Fortran compile it and run it successfully.
>>
>> Who is right? Has the standard changed since F95?
>
> F2003, 16.2.3
>
> "Within a scoping unit, two procedures that have the same generic
name
> shall both be subroutines or both be functions..."
>
> Pretty straightforward as standard-speak goes. I don't recall these
> words as changing much between f90 and f2003.
>
> Note that it is not a constraint, so compilers are not required to
> diagnose the error. That means that all of the compilers are "right"
in
> some sense; allowing this would be an extension rather than an error
in
> teh compiler.
>
> That being said, at least a warning would be nice, even if not
required
> by the standard. Have you tried turning on warnings for nonstandard
> features in gfortran and Intel?
>
Thank you Richard. You're right, I should have switched on the
compiler warnings.
/Sakis