189. PDT can have fixed parameters at compile time or be ALLOCATABLE.#

topic: Parameterized derived types

Note

This tip is a draft1.

A PDT can have fixed parameters at compile time or be ALLOCATABLE.

type(matrix(n1=3,n2=6,wp=kind(1d0))) :: a type(matrix(:,:)), allocatable :: b allocate (matrix(3,6) :: b)

The type parameters are accessible, read-only, as

a%n1, a%n2, a%wp



1

From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.