[J3] [SC22WG5.6544] Why can't USE come after IMPLICIT NONE?

Van Snyder van.snyder at sbcglobal.net
Sun Feb 18 21:31:29 UTC 2024


On Sun, 2024-02-18 at 20:47 +0000, Jeff Hammond via J3 wrote:
> I know, but why?

The type spec in an  IMPLICIT statement might depend upon a type or
named constant gotten by use association.
> If not for this constraint, we could modernize all the MPI Fortran
> codes in existence by placing making the sole contents of mpif.h “USE
> MPI” but instead, we’ll need intelligent scripts that have to figure
> out the ordering of line replacements, potentially
>  across compilation units.
> 
> 
> 
> Jeff
> 
> 
> 
> > On 18. Feb 2024, at 22.44, Damian Rouson <rouson at lbl.gov> wrote:
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > External email: Use caution opening links or attachments
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Implicit statements must come after use statements.  If you swap
> > the implicit and use statements, the code you provided compiles
> > without error with two compilers that I tried.
> > 
> > 
> > 
> > Damian
> > 
> > 
> > 
> > 
> > On Sun, Feb 18, 2024 at 12:31 PM Jeff Hammond via J3 <
> > j3 at mailman.j3-fortran.org> wrote:
> > 
> > 
> > > Can someone explain to me why the following is illegal?  Is there
> > > a risk that someone defines implicit variables in a module and
> > > that effect being invisible to the user?  Would it not have been
> > > better to exclude implicit variable declaration in modules?
> > > 
> > > 
> > > 
> > > module m
> > > 
> > >   implicit integer (a-z)
> > > 
> > > end module m
> > > 
> > > 
> > > 
> > > program main
> > > 
> > >   implicit real (a-z)
> > > 
> > >   use m
> > > 
> > >   real x
> > > 
> > > end program main
> > > 
> > > 
> > > 
> > > Thanks,
> > > 
> > > 
> > > 
> > > Jeff
> > 
> > 
> > 
> > 
> 
> 
> 
> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20240218/8f798ad3/attachment.htm>


More information about the J3 mailing list