null

Date:

02-08-2023

NAME

NULL - Returns a disassociated pointer

SYNOPSIS

NULL ([[MOLD=]mold])

STANDARDS

Fortran

DESCRIPTION

The NULL intrinsic function returns a disassociated pointer. It accepts the following argument:

mold

A pointer of any type. This is an optional argument. Its pointer association status can be undefined, disassociated, or associated. If its status is associated, the target need not be defined with a value.

  • The mold argument must be specified when a reference to NULL appears as an actual argument in a reference to a generic procedure if the type, type parameters, or rank is required to resolve the generic reference.

This is a transformational function.

RETURN VALUES

NULL returns a disassociated pointer. The pointer has no shape, but it does have rank.

If mold is specified, the return value has the same characteristics as mold.

If mold is not specified, the data type, type parameters, and rank of the result are determined by the pointer that becomes associated with the result, as follows:

Appearance of NULL:

Result type, type parameters, rank

Right side of a pointer assignment

Pointer on the left side

Initialization for an object in a declaration

The object

Default initialization for a component

The component

In a structure constructor

The corresponding component

As an actual argument

The corresponding dummy argument

In a DATA statement

The corresponding pointer object

EXAMPLES

INTERFACE GEN
   SUBROUTINE S1 (J, PI)
      INTEGER J
      INTEGER, POINTER :: PI
   END SUBROUTINE S1
   SUBROUTINE S2 (K, PR)
      INTEGER K
      REAL, POINTER :: PR
   END SUBROUTINE S2
END INTERFACE
REAL, POINTER :: REAL_PTR
CALL GEN (7, NULL (REAL_PTR) )    ! INVOKE S2