A derived-type definition specifies the name of a user-defined type and the types of its components. It takes the following form: TYPE [[, PRIVATE or PUBLIC] :: ] name [PRIVATE or SEQUENCE]... comp-def [comp-def]... END TYPE [name] name Is the name of the derived type. It must not be the same as the name of any intrinsic type, or the same as the name of a derived type that can be accessed from a module. comp-def There must be at least one. It takes the following form: type [ [, attr-list] ::] comp [(a-spec)] [*char-len] [init_ex] type Is a type specifier. It can be an intrinsic type or a previously defined derived type. (If the POINTER attribute follows this specifier, the type can also be any accessible derived type, including the type being defined.) attr-list Is an optional list of component attributes POINTER or DIMENSION. You can specify one or both attributes. If DIMENSION is specified, it can be followed by an array specification. comp Is the name of the component being defined. a-spec Is an optional array specification, enclosed in parentheses. If POINTER is specified, the array is deferred-shape; otherwise, it is explicit-shape. In an explicit-shape specification, each bound must be a constant scalar integer expression. char-len Is an optional scalar integer literal constant; it must be preceded by an asterisk (*). This parameter can only be specified if the component is of type CHARACTER. init_ex Is an initialization expression or, for pointer objects, =>NULL(). If a name is specified following the END TYPE statement, it must be the same name that follows TYPE in the derived type statement. Within a scoping unit, a derived-type name can only be defined once. If the same derived-type name appears in a derived-type definition in another scoping unit, it is treated independently. A component name has the scope of the derived-type definition only. Therefore, the same name can be used in another derived-type definition in the same scoping unit. Two entities can have the same derived type in the following cases: o If they are both declared to be of the same derived type, and the derived-type definition can be accessed from the same module, the same scoping unit, or a host scoping unit. o If they are both declared to be of the same derived type, and the derived-type definition can be accessed from the same scoping unit or a host scoping unit. o If they are both declared in a derived-type definition specifying SEQUENCE (they both have sequence type). A sequence type can be defined in each scoping unit that needs to access the type. Each derived-type definition must specify the same name, the keyword SEQUENCE, and have components that agree in order, name, and attributes. (No private components are allowed in a sequence type.) The same PRIVATE or SEQUENCE statements can only appear once in a given derived-type definition. If SEQUENCE is present, all derived types specified in component definitions must be sequence types. The PUBLIC or PRIVATE keywords can only appear if the derived-type definition is in the specification part of a module. The POINTER or DIMENSION attribute can only appear once in a given comp-def. A component is an array if the component definition contains a DIMENSION attribute or an array specification. If the component definition contains an array specification, the array bounds should be specified there; otherwise, they must be specified following the DIMENSION attribute. If an initialization expression ("init_ex") appears for a nonpointer component, the component (in any object of the type) is initially defined with the value determined from the initialization expression. The initialization expression is evaluated in the scoping unit of the type definition. The initialization expression overrides any default initial value specified for the component. Explicit initialization in a type declaration statement overrides default initialization. If POINTER appears in the comp-def, the component is a pointer. Pointers can have an association status of associated, disassociated, or undefined. If no default initialization status is specified, the status of the pointer is undefined. To specify disassociated status for a pointer component, use =>NULL().