Derived type components

The components of a derived type can be of any intrinsic type or can be of a previously defined derived type. The components of a derived type can be either direct or ultimate.

Direct components of a derived type are components that satisfy any of the following conditions:
  • The components of that derived type.
  • The direct components of a derived type component that has neither the ALLOCATABLE nor the POINTER attribute.
Ultimate components are components that satisfy any of the following three conditions:
  • Components of intrinsic data type.
  • Components with the ALLOCATABLE or POINTER attribute.
  • The ultimate components of a derived type component that has neither the ALLOCATABLE nor POINTER attribute.

You can specify a default initialization for each nonallocatable component in the definition of a derived type. Allocatable components are always initialized to deallocated.

An attribute cannot appear more than once in a type declaration statement or a procedure component declaration statement.

If you specify neither the ALLOCATABLE nor the POINTER attribute for a component, that component must be of an intrinsic type or a previously defined derived type.

If you specify neither the ALLOCATABLE nor the POINTER attribute for an array component, the array bounds must be explicitly specified for each dimension. Each bound must be an expression that does not include any references to specification functions or the following intrinsic functions: ALLOCATED, ASSOCIATED, EX-TENDS TYPE OF, PRESENT, or SAME TYPE AS. Each specification inquiry reference is a constant expression whose value does not depend on a variable value.

When you define a component, the value of a type parameter must be a colon or an expression that does not include any references to specification functions or the following intrinsic functions: ALLOCATED, ASSO-CIATED, EXTENDS TYPE OF, PRESENT, or SAME TYPE AS. Each specification inquiry reference is a constant expression whose value does not depend on a variable value.

A component of a derived type must not appear as an input/output list item if any ultimate component of the object cannot be accessed by the scoping unit of the input/output statement, unless a user-defined input/output procedure processes the derived-type object. A derived-type object must not appear in a data transfer statement if the object has a component that is a pointer or allocatable, unless a user-defined input/output procedure processes the object.



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