Visible to Intel only — GUID: GUID-71C7BC85-C1BE-4D57-836B-E562246B58C8
Visible to Intel only — GUID: GUID-71C7BC85-C1BE-4D57-836B-E562246B58C8
ENTRY
Statement: Provides one or more entry points within a subprogram. It is not executable. The ENTRY statement is an obsolescent feature in the Fortran standard.
ENTRY name[ ( [d-arg[,d-arg]...] ) [suffix] ]
name |
Is the name of an entry point. If RESULT is specified, this entry name must not appear in any specification statement in the scoping unit of the function subprogram. |
d-arg |
(Optional) Is a dummy argument. The dummy argument can be an alternate return indicator (*) only if the ENTRY statement is within a subroutine subprogram. |
suffix |
(Optional) Is one of the following: RESULT (r-name) [language-binding-spec] or language-binding-spec [RESULT (r-name)] |
r-name |
(Optional) Is the name of a function result. This name must not be the same as the name of the entry point, or the name of any other function or function result. This parameter can only be specified for function subprograms. |
language-binding-spec |
Is the following: BIND (C [, NAME = scalar-default-char-constant-expr]) If NAME appears, scalar-default-char-constant-expr specifies the external name of the procedure defined by this ENTRY statement. |
Description
ENTRY statements can only appear in an external procedure or a module procedure that is not the definition of a separate module procedure. An ENTRY statement cannot appear in an internal procedure. A subprogram can contain zero or more ENTRY statements.
An ENTRY statement must not appear in an executable construct.
When the ENTRY statement appears in a subroutine subprogram, it is referenced by a CALL statement. When the ENTRY statement appears in a function subprogram, it is referenced by a function reference.
An entry name within a function subprogram can appear in a type declaration statement, unless RESULT is specified. If RESULT is specified, r-name can appear in a type declaration statement, and the entry name cannot appear in a type declaration statement or other specification statements.
Within the subprogram containing the ENTRY statement, the entry name must not appear as a dummy argument in the FUNCTION or SUBROUTINE statement, and it must not appear in an EXTERNAL or INTRINSIC statement. For example, neither of the following are valid:
(1) SUBROUTINE SUB(E)
ENTRY E
...
(2) SUBROUTINE SUB
EXTERNAL E
ENTRY E
...
The procedure defined by an ENTRY statement can reference itself if the function or subroutine in which it appears is recursive.
Dummy arguments can be used in ENTRY statements even if they differ in order, number, type and kind parameters, and name from the dummy arguments used in the FUNCTION, SUBROUTINE, and other ENTRY statements in the same subprogram. However, each reference to a function, subroutine, or entry must use an actual argument list that agrees in order, number, and type with the dummy argument list in the corresponding FUNCTION, SUBROUTINE, or ENTRY statement.
Dummy arguments can be referred to only in executable statements that follow the first SUBROUTINE, FUNCTION, or ENTRY statement in which the dummy argument is specified. If a dummy argument is not currently associated with an actual argument, the dummy argument is undefined and cannot be referenced. Arguments do not retain their association from one reference of a subprogram to another.
Example
C This fragment writes a message indicating
C whether num is positive or negative
IF (num .GE. 0) THEN
CALL Sign
ELSE
CALL Negative
END IF
...
END
SUBROUTINE Sign
WRITE (*, *) 'It''s positive.'
RETURN
ENTRY Negative
WRITE (*, *) 'It''s negative.'
RETURN
END SUBROUTINE