ENTRY statement
Standard: F77 F90 F95 F2003 F2008
<Syntax>
ENTRY name [ ( [ args ] ) [ suffix ]... ]

args ::= arg [ , arg ]...

arg ::= name  |  *

suffix::=BIND ( C [ , NAME=expression ] )
 | RESULT(name)

The ENTRY statement may appear in the specification part or in the executable part of a function or subroutine subprogram. The RESULT clause is only allowed within a function subprogram. An arg of “*” is only allowed within a subroutine subprogram.

Only one occurrence of any particular suffix is allowed in a single ENTRY statement.

ENTRY statements are not permitted in internal subprograms.

<Semantics>
The ENTRY statement defines an additional procedure with a subprogram. If the subprogram is a function subprogram, it defines an additional function; if it is a subroutine subprogram, it defines an additional subroutine.

The dummy arguments of the entry procedure are those listed on the ENTRY statement, and the procedure begins executing at the first executable statement after the ENTRY statement. Reference to a dummy argument is only permitted if it is listed in the statement that defines the procedure being executed; i.e., when executing an entry procedure, it is only permissible to reference dummy arguments of the entry procedure and not those of any other procedure defined by the subprogram. All other entities are shared between the defined procedures.

Multiple ENTRY statements are permitted; each one defines an additional procedure.

In a function subprogram, the result variable of each function defined is associated with the others. All result variables in a function subprogram must have the same type and kind, except that default real, double precision real, default integer, default logical and default complex may be mixed.

The procedure defined by an ENTRY statement is:

  • elemental if and only if the containing subprogram has the ELEMENTAL attribute;
  • pure if and only if the containing subprogram has the PURE attribute, or the ELEMENTAL attribute without the IMPURE attribute;
  • recursive if and only if the containing subprogram has the RECURSIVE attribute.

    The procedure defined by an ENTRY statement is “interoperable” if and only if the BIND clause appears on the ENTRY statement. This is completely independent of whether the containing subprogram has the BIND attribute.

    It is recommended that module subprograms be used for code and data sharing instead of ENTRY statements, as their use is prone to error.

    ENTRY statements are considered obscolescent in Fortran 2008.

  • <Related>
    BIND attribute, FUNCTION statement, SUBROUTINE statement