SIZE

Platform

x64, Win32, .NET

Purpose

To get the extent of an array along a specified dimension or the total number of elements in the array.

Class

Inquiry function.

Syntax

INTEGER FUNCTION SIZE(ARRAY [, DIM [, KIND]])
INTEGER DIM, KIND

Description

ARRAY is an array of any type. If it is allocatable it must be allocated. If it is a pointer it must be associated. If it is an assumed size array then DIM must be present and have a value which is less than the rank of ARRAY.

If DIM is present it is a scalar in the range 1 < DIM < n where n is the rank of ARRAY.
If KIND is present it provides the INTEGER kind value of the result.

Return value

The result has a value equal to the extent of dimension DIM of ARRAY or, if DIM is absent, the total number of elements of ARRAY.

Notes

The Fortran Standard stipulates that the SIZE intrinsic function (without a KIND argument) should return an value of default integer type. For FTN95 this is a 32 bit integer unless the default is changed via a command line switch. FTN95 is not standard conforming in this respect for the x64 platform unless /SIZE_ISO or /ISO is used on the command line. In other words, SIZE usually provides a 64 bit value for x64. An exception to this rule is that a call to a routine of the the form FUNC(SIZE(...)) is standard conforming. This is because the type of an argument will be critical when used with generic functions.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited