I prefer (but the Fortran standard does NOT require) that all module entities
used outside the module should be explicitly declared
PUBLIC.

g95 has an option -fmodule-private such that

g95 -fmodule-private for the code

module foo_mod
implicit none
! public :: i
integer :: i
end module foo_mod

program main
use foo_mod, only: i
i = 1
print*,"i=",i
end program main

gives

In file xmod_private.f90:8

use foo_mod, only: i
                   1
Error: Symbol 'i' referenced at (1) not found in
module 'foo_mod'

I'd like a similar option in gfortran.

Vivek Rao


-- 
           Summary: option to make module entities PRIVATE by default
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vivekrao4 at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31629

Reply via email to