Home

10.2 ISO_C_BINDING

Standard:

Fortran 2003 and later, GNU extensions

The following intrinsic procedures are provided by the module; their definition can be found in the section Intrinsic Procedures of this manual.

C_ASSOCIATED
C_F_POINTER
C_F_PROCPOINTER
C_FUNLOC
C_LOC
C_SIZEOF

The ISO_C_BINDING module provides the following named constants of type default integer, which can be used as KIND type parameters.

In addition to the integer named constants required by the Fortran 2003 standard and C_PTRDIFF_T of TS 29113, GNU Fortran provides as an extension named constants for the 128-bit integer types supported by the C compiler: C_INT128_T, C_INT_LEAST128_T, C_INT_FAST128_T. Furthermore, if __float128 is supported in C, the named constants C_FLOAT128, C_FLOAT128_COMPLEX are defined.

Fortran TypeNamed constantC typeExtension
INTEGERC_INTint
INTEGERC_SHORTshort int
INTEGERC_LONGlong int
INTEGERC_LONG_LONGlong long int
INTEGERC_SIGNED_CHARsigned char/unsigned char
INTEGERC_SIZE_Tsize_t
INTEGERC_INT8_Tint8_t
INTEGERC_INT16_Tint16_t
INTEGERC_INT32_Tint32_t
INTEGERC_INT64_Tint64_t
INTEGERC_INT128_Tint128_tExt.
INTEGERC_INT_LEAST8_Tint_least8_t
INTEGERC_INT_LEAST16_Tint_least16_t
INTEGERC_INT_LEAST32_Tint_least32_t
INTEGERC_INT_LEAST64_Tint_least64_t
INTEGERC_INT_LEAST128_Tint_least128_tExt.
INTEGERC_INT_FAST8_Tint_fast8_t
INTEGERC_INT_FAST16_Tint_fast16_t
INTEGERC_INT_FAST32_Tint_fast32_t
INTEGERC_INT_FAST64_Tint_fast64_t
INTEGERC_INT_FAST128_Tint_fast128_tExt.
INTEGERC_INTMAX_Tintmax_t
INTEGERC_INTPTR_Tintptr_t
INTEGERC_PTRDIFF_Tptrdiff_tTS 29113
REALC_FLOATfloat
REALC_DOUBLEdouble
REALC_LONG_DOUBLElong double
REALC_FLOAT128__float128Ext.
COMPLEXC_FLOAT_COMPLEXfloat _Complex
COMPLEXC_DOUBLE_COMPLEXdouble _Complex
COMPLEXC_LONG_DOUBLE_COMPLEXlong double _Complex
REALC_FLOAT128_COMPLEX__float128 _ComplexExt.
LOGICALC_BOOL_Bool
CHARACTERC_CHARchar

Additionally, the following parameters of type CHARACTER(KIND=C_CHAR) are defined.

NameC definitionValue
C_NULL_CHARnull character'\0'
C_ALERTalert'\a'
C_BACKSPACEbackspace'\b'
C_FORM_FEEDform feed'\f'
C_NEW_LINEnew line'\n'
C_CARRIAGE_RETURNcarriage return'\r'
C_HORIZONTAL_TABhorizontal tab'\t'
C_VERTICAL_TABvertical tab'\v'

Moreover, the following two named constants are defined:

NameType
C_NULL_PTRC_PTR
C_NULL_FUNPTRC_FUNPTR

Both are equivalent to the value NULL in C.