]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/compiler-characteristics/kind-type-parameters.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / compiler-characteristics / kind-type-parameters.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: kind
7
8 .. _kind-type-parameters:
9
10 KIND Type Parameters
11 ********************
12
13 The ``KIND`` type parameters supported by GNU Fortran for the primitive
14 data types are:
15
16 ``INTEGER``
17
18 1, 2, 4, 8 [#f1]_, 16 [#f1]_, default: 4 [#f2]_
19
20 ``LOGICAL``
21
22 1, 2, 4, 8 [#f1]_, 16 [#f1]_, default: 4 [#f2]_
23
24 ``REAL``
25
26 4, 8, 10 [#f1]_, 16 [#f1]_, default: 4 [#f3]_
27
28 ``COMPLEX``
29
30 4, 8, 10 [#f1]_, 16 [#f1]_, default: 4 [#f3]_
31
32 ``DOUBLE PRECISION``
33
34 4, 8, 10 [#f1]_, 16 [#f1]_, default: 8 [#f3]_
35
36 ``CHARACTER``
37
38 1, 4, default: 1
39
40 .. [#f1] not available on all systems
41 .. [#f2] unless :option:`-fdefault-integer-8` is used
42 .. [#f3] unless :option:`-fdefault-real-8` is used (see :ref:`fortran-dialect-options`)
43
44 The ``KIND`` value matches the storage size in bytes, except for
45 ``COMPLEX`` where the storage size is twice as much (or both real and
46 imaginary part are a real value of the given size). It is recommended to use
47 the :ref:`SELECTED_CHAR_KIND`, :ref:`SELECTED_INT_KIND` and
48 :ref:`SELECTED_REAL_KIND` intrinsics or the ``INT8``, ``INT16``,
49 ``INT32``, ``INT64``, ``REAL32``, ``REAL64``, and ``REAL128``
50 parameters of the ``ISO_FORTRAN_ENV`` module instead of the concrete values.
51 The available kind parameters can be found in the constant arrays
52 ``CHARACTER_KINDS``, ``INTEGER_KINDS``, ``LOGICAL_KINDS`` and
53 ``REAL_KINDS`` in the :ref:`ISO_FORTRAN_ENV` module. For C interoperability,
54 the kind parameters of the :ref:`ISO_C_BINDING` module should be used.