(j3.2006) Question about submodule using its ancestor modue

Bill Long longb
Tue Nov 18 18:05:34 EST 2014


Is the USE statement in the submodule below conforming?

module m1
  real :: x
end module m1

submodule (m1) bar
  use m1
end submodule bar

Option 1: It is OK, since the USE of m1 in the submodule blocks all host association of objects in module m1, so no ambiguity.

Option 2: No. The submodule is an extension of m1 and this amounts to a recursive access to the module. 


I suspect Option 2 would promote better code and fewer mistakes. Particularly if ?use m1? were instead ?use m2? where m2 included a USE of m1.


Cheers,
Bill


Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101





More information about the J3 mailing list