• Re: writing a module file in gfortran 14

    From Thomas Koenig@21:1/5 to Lynn McGuire on Wed Dec 4 20:11:34 2024
    Lynn McGuire <[email protected]> schrieb:
    Is the "implicit none" in the proper place in the following code ?

    No.

    [snip]

    You want

    module aaa_modules

    implicit none

    INTERFACE
    SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE)
    IMPLICIT NONE

    ...

    because declarations in the outer module have no meaning on
    interfaces.

    A rather frequent source of confusion, I'm afraid (I got bitten
    by this myself in the past).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gary Scott@21:1/5 to Lynn McGuire on Wed Dec 4 18:40:08 2024
    On 12/4/2024 3:20 PM, Lynn McGuire wrote:
    On 12/4/2024 2:11 PM, Thomas Koenig wrote:
    Lynn McGuire <[email protected]> schrieb:
    Is the "implicit none" in the proper place in the following code ?

    No.

    [snip]

    You want

           module aaa_modules

                implicit none

                INTERFACE
                  SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE) >>                   IMPLICIT NONE

    ...

    because declarations in the outer module have no meaning on
    interfaces.

    A rather frequent source of confusion, I'm afraid (I got bitten
    by this myself in the past).

    Woof !  I was afraid of that.  The Fortran Module definition seems to be very fragile.

    That is going to be painful to add to my module file.

    Lynn

    The interface is its own entity. I think the design is correct in
    requiring the implicit none to be repeated. While I might have
    preferred a "file scope" design more, as long as there is consistency in
    the design, I'm ok with it.

    Sorry for the direct email :( intended to post here

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Gary Scott on Thu Dec 5 01:45:28 2024
    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the better, I think.

    In the meantime, gfortran (which is all anybody seems to be using anyway)
    has “-fimplicit-none” ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gary Scott@21:1/5 to Lawrence D'Oliveiro on Wed Dec 4 20:33:00 2024
    On 12/4/2024 7:45 PM, Lawrence D'Oliveiro wrote:
    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the better, I think.

    In the meantime, gfortran (which is all anybody seems to be using anyway)
    has “-fimplicit-none” ...

    I've long favored that. The consensus when it was discussed in the 90s
    was that it would never happen.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steven G. Kargl@21:1/5 to Lawrence D'Oliveiro on Sat Dec 7 05:44:56 2024
    On Thu, 05 Dec 2024 01:45:28 +0000, Lawrence D'Oliveiro wrote:

    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the better, I think.

    IMPLICIT NONE is a part of the Fortran standard. It's been
    a part for a very long time. Perhaps, you meant that IMPLICIT
    NONE should be the default behavior. That will never happen.

    --
    steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steven G. Kargl@21:1/5 to Thomas Koenig on Sat Dec 7 05:42:20 2024
    On Wed, 04 Dec 2024 20:11:34 +0000, Thomas Koenig wrote:

    Lynn McGuire <[email protected]> schrieb:
    Is the "implicit none" in the proper place in the following code ?

    No.


    Technically, the answer is 'yes' to the question asked.


    You want

    module aaa_modules

    implicit none

    INTERFACE
    SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE)
    IMPLICIT NONE

    ...

    because declarations in the outer module have no meaning on
    interfaces.

    This is the answer to the question you meant to ask. An interface
    construct introduces a new namespace and blocks host association.
    As such, Fortran's implicit typing rules apply

    --
    steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Steven G. Kargl on Sat Dec 7 07:48:48 2024
    On Sat, 7 Dec 2024 05:44:56 -0000 (UTC), Steven G. Kargl wrote:

    On Thu, 05 Dec 2024 01:45:28 +0000, Lawrence D'Oliveiro wrote:

    On Wed, 4 Dec 2024 18:40:08 -0600, Gary Scott wrote:

    I think the design is correct in requiring the implicit none to be
    repeated.

    The sooner that implicit “IMPLICIT NONE” is added to the standard, the >> better, I think.

    IMPLICIT NONE is a part of the Fortran standard.

    Note what I said: implicit “IMPLICIT NONE”.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)