# 5.11 INTRINSIC Attribute and Statement

The INTRINSIC attribute allows the specific name of an intrinsic procedure to be used as an actual argument. (Not all specific names can be used as actual arguments. For more information, see Table 9-1.)

The INTRINSIC attribute can be specified in a type declaration statement or an INTRINSIC statement, and takes one of the following forms:

Type Declaration Statement:

  type, [att-ls,] INTRINSIC [, att-ls] :: in-pro [, in-pro]...

Statement:

  INTRINSIC in-pro [, in-pro]...
  type
  Is a data type specifier.
  att-ls
  Is an optional list of attribute specifiers.
  in-pro
  Is the name of an intrinsic procedure.

Rules and Behavior

In a type declaration statement, only functions can be declared INTRINSIC. However, you can use the INTRINSIC statement to declare subroutines, as well as functions, to be intrinsic.

The name declared INTRINSIC is assumed to be the name of an intrinsic procedure. If a generic intrinsic function name is given the INTRINSIC attribute, the name retains its generic properties.

Examples

The following example shows a type declaration statement specifying the INTRINSIC attribute:

    PROGRAM EXAMPLE
    ...
    REAL(8), INTRINSIC :: DACOS
    ...
    CALL TEST(X, DACOS)     ! Intrinsic function DACOS is an actual argument

The following example shows an INTRINSIC statement:

Main Program | Subprogram
--- | ---
`EXTERNAL CTN` | `SUBROUTINE TRIG(X,F,Y)`
`INTRINSIC SIN, COS` | `Y = F(X)`
. . . | `RETURN`
| `END`
`CALL TRIG(ANGLE,SIN,SINE)` |
. . . | `FUNCTION CTN(X)`
| `CTN = COS(X)/SIN(X)`
`CALL TRIG(ANGLE,COS,COSINE)` | `RETURN`
. . . | `END`
`CALL TRIG(ANGLE,CTN,COTANGENT)` |

Note that when TRIG is called with a second argument of SIN or COS, the function reference F(X) references the Fortran 95/90 library functions SIN and COS; but when TRIG is called with a second argument of CTN, F(X) references the user function CTN.

For More Information:

- On type declaration statements, see Section 5.1.
- On specific intrinsic procedures, see Chapter 9.
- On referencing generic intrinsic functions, see Section 8.8.8.1.
- On referencing elemental intrinsic procedures, see Section 8.8.8.2.
- On compatible attributes, see Table 5-1.

Previous Page Next Page Table of Contents