Type declaration: type parameters and specifiers

This is an overview section on declaring the type of an entity. The Statements section contains the particular syntax details and rules for derived and intrinsic type declarations.

XL Fortran provides one or more representation methods for each intrinsic data type. You can optionally specify this representation method with a kind type parameter value, using kind_param in your type declaration statement. This value can indicate:
  • The range for the integer data type.
  • The decimal precision and exponent range for the real data type.
  • The decimal precision and exponent range for the complex data type.
  • The representation method for the character data type.
  • The representation method for the logical data type.

The BYTE intrinsic type does not have a kind type parameter.

A length type parameter specifies the number of characters for entities of type character.

A type specifier denotes the type of all entities declared in a type declaration statement. The INTEGER, REAL, COMPLEX, LOGICAL, and CHARACTER type specifiers can include a kind_selector, that specifies the kind type parameter.

For example, here are some common ways you can declare a 4-byte integer:
  • INTEGER(4)
  • INTEGER(KIND=4)
  • INTEGER, where the default integer size is set to 4 bytes.
  • Fortran 2008 beginsTYPE(INTEGER(4))Fortran 2008 ends
  • Fortran 2008 beginsTYPE(INTEGER(KIND=4))Fortran 2008 ends
  • Fortran 2008 beginsTYPE(INTEGER), where the default integer size is set to 4 bytes.Fortran 2008 ends

This document references 4-byte integers as INTEGER(4).

See Type Declaration for detailed information about type specifiers.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us