The following table shows the data types that can appear in noncharacter type declaration statements.
Noncharacter Data Types | |
---|---|
BYTE1 | |
LOGICAL2 | |
LOGICAL([KIND=]1) (or LOGICAL*1) | |
LOGICAL([KIND=]2) (or LOGICAL*2) | |
LOGICAL([KIND=]4) (or LOGICAL*4) | |
LOGICAL([KIND=]8) (or LOGICAL*8) | |
INTEGER3 | |
INTEGER([KIND=]1) (or INTEGER*1) | |
INTEGER([KIND=]2) (or INTEGER*2) | |
INTEGER([KIND=]4) (or INTEGER*4) | |
INTEGER([KIND=]8) (or INTEGER*8) | |
REAL4 | |
REAL([KIND=]4) (or REAL*4) | |
DOUBLE PRECISION (REAL([KIND=]8) or REAL*8) | |
REAL([KIND=]16) (or REAL*16) | |
COMPLEX5 | |
COMPLEX([KIND=]4) (or COMPLEX*8) | |
DOUBLE COMPLEX (COMPLEX([KIND=]8)or COMPLEX*16) | |
COMPLEX([KIND=]16) (or COMPLEX*32) | |
1 Same as INTEGER(1). 2 This is treated as default logical. 3 This is treated as default integer. 4 This is treated as default real. 5 This is treated as default complex. |
In noncharacter type declaration statements, you can optionally specify the name of the data object or function as v*n, where n is the length (in bytes) of v. The length specified overrides the length implied by the data type.
The value for n must be a valid length for the type of v. The type specifiers BYTE, DOUBLE PRECISION, and DOUBLE COMPLEX have one valid length, so the n specifier is invalid for them.
For an array specification, the n must be placed immediately following the array name; for example, in an INTEGER declaration statement, IVEC*2(10) is an INTEGER(2) array of 10 elements.
Note that certain compiler options can affect the defaults for numeric and logical data types.
Examples
In a noncharacter type declaration statement, a subsequent kind parameter overrides any initial kind parameter. For example, consider the following statements:
INTEGER(KIND=2) I, J, K, M12*4, Q, IVEC*4(10)
REAL(KIND=8) WX1, WXZ, WX3*4, WX5, WX6*4
REAL(KIND=8) PI/3.14159E0/, E/2.72E0/, QARRAY(10)/5*0.0,5*1.0/
In the first statement, M12*4 and IVEC*4 override the KIND=2 specification. In the second statement, WX3*4 and WX6*4 override the KIND=8 specification. In the third statement, QARRAY is initialized with implicit conversion of the REAL(4) constants to a REAL(8) data type.
See Also
For details on the general form and rules for type declaration statements, see Type Declarations.