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

Jeff Hammond jehammond at nvidia.com
Sun Feb 18 20:47:55 UTC 2024


I know, but why?

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<mailto: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/a9c0c249/attachment.htm>


More information about the J3 mailing list