This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gfortran problem - interface name conflict


I took a quick spin through the standard but couldn't find any requirement that names of dummy arguments should be different from subroutine or interface names. (That doen't mean that such a specification is not there but rather that I lost patience with looking for it.)

However, I note the following:

(1) The following is not accepted by the Digital compiler, for example

subroutine subs ( subs )
 integer, intent(inout) :: subs
 print *, "sub1 ",subs
end subroutine subs

:\gfortran\subs.f90(1) : Error: Conflicting attributes or multiple declaration of name. [SUBS]

Thus, it is not apparent to me that it is consistent or desirable to allow such name overlaps in the interface declaration.

(2) I do not think that it is good practice to reuse symbol names like that. When it comes to overloading functions or subroutines, some means of distinguishing the dummy arguments is desirable, going on essential.

For example,

interface subs
 subroutine sub1 ( i_subs )
   integer, intent(inout) :: i_subs
 end subroutine sub1
 subroutine sub2 ( r_subs )
   real, intent(inout) :: r_subs
 end subroutine sub2
end interface subs

works a treat with every compiler that I have access to and is crystal clear.

Regards

Paul Thomas



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]