Next: Fortran Operators and Expressions, Up: Fortran [Contents][Index]

#### 15.4.6.1 Fortran Types

In Fortran the primitive data-types have an associated `KIND` type parameter, written as ‘`type*kindparam`’, ‘`type*kindparam`’, or in the GDB-only dialect ‘`type_kindparam`’. A concrete example would be ‘``Real*4``’, ‘``Real(kind=4)``’, and ‘``Real_4``’. The kind of a type can be retrieved by using the intrinsic function `KIND`, see Fortran Intrinsics.

Generally, the actual implementation of the `KIND` type parameter is compiler specific. In GDB the kind parameter is implemented in accordance with its use in the GNU `gfortran` compiler. Here, the kind parameter for a given type specifies its size in memory — a Fortran `Integer*4` or `Integer(kind=4)` would be an integer type occupying 4 bytes of memory. An exception to this rule is the `Complex` type for which the kind of the type does not specify its entire size, but the size of each of the two `Real`’s it is composed of. A `Complex*4` would thus consist of two `Real*4`s and occupy 8 bytes of memory.

For every type there is also a default kind associated with it, e.g. `Integer` in GDB will internally be an `Integer*4` (see the table below for default types). The default types are the same as in GNU compilers but note, that the GNU default types can actually be changed by compiler flags such as `-fdefault-integer-8` and `-fdefault-real-8`.

Not every kind parameter is valid for every type and in GDB the following type kinds are available.

`Integer`

  `Integer*1`, `Integer*2`, `Integer*4`, `Integer*8`, and `Integer` = `Integer*4`.

`Logical`

  `Logical*1`, `Logical*2`, `Logical*4`, `Logical*8`, and `Logical` = `Logical*4`.

`Real`

  `Real*4`, `Real*8`, `Real*16`, and `Real` = `Real*4`.

`Complex`

  `Complex*4`, `Complex*8`, `Complex*16`, and `Complex` = `Complex*4`.

Next: Fortran Operators and Expressions, Up: Fortran [Contents][Index]