CONTIGUOUS

Statement and Attribute: Specifies that the target of a pointer or an assumed-sized array is contiguous.

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

Type Declaration Statement:

type, [att-ls,] CONTIGUOUS [, att-ls] :: object [, object] ...

Statement:

CONTIGUOUS [::] object [, object] ...

type

Is a data type specifier.

att-ls

Is an optional list of attribute specifiers.

object

Is an assumed-shape array or an array pointer.

Description

This attribute explicitly indicates that an assumed-shape array is contiguous or that a pointer will only be associated with a contiguous object.

An entity can be contiguous even if CONTIGUOUS is not specified. An object is contiguous if it is one of the following:

An object is not contiguous if it is an array subobject, and all of the following are true:

The CONTIGUOUS attribute can make it easier to enable optimizations that rely on the memory layout of an object occupying a contiguous block of memory.

An array variable is considered to be simply contiguous if and only if it is a simply contiguous array designator, or a reference to a function that returns a pointer that has the CONTIGUOUS attribute. An array designator is simply contiguous if and only if it is one of the following:

A section-subscript list specifies a simply contiguous array section if and only if it does not have a vector subscript and the following is true:

Examples

The following examples show valid CONTIGUOUS statements:

REAL, CONTIGUOUS, DIMENSION(:,:) :: A
REAL, POINTER, CONTIGUOUS :: MY_POINTER(:)

See Also