Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

4.6.12 Fortran 2003 Enhanced Array Constructor

Use of square brackets in place of (/ and /) in array constructors is allowed:

X = [ 3.2, 4.01, 6.5 ]

The Fortran 2003 standard allows the use of square brackets as array constructors. This can conflict with interval constants. When the square brackets are used without the -xia option (or similar options to enable interval arithmetic) they are treated as array constructors. When -xia option is used, they are treated as constants. Interval users should continue using (/ and /) array constructors to avoid compilation errors.

The array components within an array constructor can have two forms:

type-spec ::

or

[type-spec ::] ac-value-list

When the optional type-spec is present, the types and kinds of the array components do not have to be the same as long as they are type compatible to the type-spec.

type-spec can be an intrinsic type or a derived type.