Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Scope of IMPLICIT NONE

Andrew_Smith
Valued Contributor I
777 Views
If we have IMPLICIT NONE in a module does its scope extend to the procedures defined in the module? It does in IVF but I do not know what the standard specifies. The IVF help file is silent on this.
0 Kudos
5 Replies
Arjen_Markus
Honored Contributor I
777 Views
It _is_ part of the standard, I do not think the online help should replicate that.

Regards,

Arjen
0 Kudos
Andrew_Smith
Valued Contributor I
777 Views
I was using local help. I think the local and online help should replicate the standard. Intel seam to agree because the local help has a section called "Language Reference" which is where IMPLICIT NONE is detailed.
0 Kudos
Kevin_D_Intel
Employee
777 Views

The IVF documentation for IMPLICIT states "When IMPLICIT NONE is used, all names in a program unit must be explicitly declared." and under "Program Units and Procedures" defines a "program unit" as one of four types:

Main program
External procedures
Modules
Block data program unit

And the compiler's treament is consistent. Itgenerates an error for the following:

[fortran]module impl
implicit none
contains
  subroutine sub
    a=1
  end subroutine sub
end module impl[/fortran]


$ ifort -c -V sample.f90
Intel Fortran Compiler Professional for applications running on IA-32, Version 11.1 Build 20100806 Package ID: l_cprof_p_11.1.073
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
Intel Fortran 11.1-2755

sample.f90(5): error #6404: This name does not have a type, and must have an explicit type.
a=1
----^
compilation aborted for sample.f90 (code 1)

0 Kudos
Kevin_D_Intel
Employee
777 Views

Just to add about knowing what the Standard specifies,as per the IVF Language Reference section Overview it states "This document contains the complete description of the Intel Fortran programming language, which includes Fortran 95, Fortran 90, and many Fortran 2003 language features. It contains information on language syntax and semantics, on adherence to various Fortran standards, and on extensions to those standards." and further under Language Standard Conformance, it notes that Intel Fortran specific extensions are displayed in the Language Reference manual in "blue" shaded text.

So the Language Reference section does help one know what the various Fortran Standards specify and what is an Intel specific extension.

0 Kudos
JVanB
Valued Contributor II
777 Views
More interesting if you override IMPLICIT NONE in subroutine sub with IMPLICIT INTEGER(A). Then the file is conforming but not if also the line b=1 appears in subroutine sub.
0 Kudos
Reply