Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Named Constants in the ISO_C_BINDING Module

The ISO_C_BINDING named constants represent kind type parameters of data representations compatible with C types.

Intrinsic-Type Constants

The following table shows interoperable Fortran types and C Types.

Fortran Type

Named Constant for the KIND

C Type

INTEGER

C_INT

int

 

C_SHORT

short int

 

C_LONG

long int

 

C_LONG_LONG

long long int

 

C_SIGNED_CHAR

signed char, unsigned char

 

C_SIZE_T

size_t

 

C_INT8_T

int8_t

 

C_INT16_T

int16_t

 

C_INT32_T

int32_t

 

C_INT64_T

int64_t

 

C_INT_LEAST8_T

int_least8_t

 

C_INT_LEAST16_T

int_least16_t

 

C_INT_LEAST32_T

int_least32_t

 

C_INT_LEAST64_T

int_least64_t

 

C_INT_FAST8_T

int_fast8_t

 

C_INT_FAST16_T

int_fast16_t

 

C_INT_FAST32_T

int_fast32_t

 

C_INT_FAST64_T

int_fast64_t

 

C_INTMAX_T

intmax_t

 

C_INTPTR_T

intptr_t

 

C_PTRDIFF_T

ptrdiff_t

REAL

C_FLOAT

float

 

C_DOUBLE

double

 

C_LONG_DOUBLE

long double

COMPLEX

C_FLOAT_COMPLEX

float _Complex

 

C_DOUBLE_COMPLEX

double _Complex

 

C_LONG_DOUBLE_COMPLEX

long double _Complex

LOGICAL1

C_BOOL

_Bool

CHARACTER2

C_CHAR

char

1 Use compiler option fpscomp logicals so that .TRUE. is 1 and .FALSE. is 0 as defined for C's _Bool.

2For character type, the length type parameter must be omitted or it must be specified by a constant expression whose value is one.

For example, an integer type with the kind type parameter C_LONG is interoperable with the C integer type "long" or any C type derived from "long".

The value of C_INT will be a valid value for an integer kind type parameter on the processor. The values for the other integer named constants (C_INT*) will be a valid value for an integer kind type parameter on the processor, if any, or one of the following:

  • -1 if the C processor defines the corresponding C type and there is no interoperating Fortran processor kind

  • -2 if the C processor does not define the corresponding C type

The values of C_FLOAT, C_DOUBLE, and C_LONG_DOUBLE will be a valid value for a real kind type parameter on the processor, if any, or one of the following:

  • -1 if the C processor's type does not have a precision equal to the precision of any of the Fortran processor's real kinds

  • -2 if the C processor's type does not have a range equal to the range of any of the Fortran processor's real kinds

  • -3 if the C processor's type has neither the precision or range equal to the precision or range of any of the Fortran processor's real kinds

  • -4 if there is no interoperating Fortran processor or kind for other reasons

The values of C_FLOAT_COMPLEX, C_DOUBLE_COMPLEX, and C_LONG_DOUBLE_COMPLEX will be the same as those of C_FLOAT, C_DOUBLE, and C_LONG_DOUBLE, respectively.

The value of C_BOOL will be a valid value for a logical kind parameter on the processor, if any, or -1.

The value of C_CHAR is the character kind.

Character Constants

The following table shows interoperable named constants and C characters:

Fortran Named Constant

Definition

C Character

C_NULL_CHAR

null character

'\0'

C_ALERT

alert

'\a'

C_BACKSPACE

backspace

'\b'

C_FORM_FEED

form feed

'\f'

C_NEW_LINE

new line

'\n'

C_CARRIAGE_RETURN

carriage return

'\r'

C_HORIZONTAL_TAB

horizontal tab

'\t'

C_VERTICAL_TAB

vertical tab

'\v'

Derived-Type Constants

The constant C_NULL_PTR is of type C_PTR; it has the value of a C null data pointer. The constant C_NULL_FUNPTR is of type C_FUNPTR; it has the value of a C null function pointer.