To add: Many Fortran compilers allow to change the default integer kind using a command line switch such as
-i8 or
-fdefault-integer-8. Thus, for the compiler, two different integer kinds need to be supported, if the specification talks about "default integer kind" - or simply uses INTEGER without specifying a kind type parameter.
While when invoking the function it does not matter as any integer value is type compatible with any integer, real or complex kind. However, there is an issue if one wants to pass the function as actual argument: In that case it matters whether one has an INTEGER(4) or INTEGER(8) returning function.*
In
OpenMP 3.0 the
omp_lib module contained the parameters
omp_integer_kind and
omp_logical_kind while the header file
omp_lib.h did not.
Expected:
- The integer returning function return an integer of kind omp_integer_kind instead of a default-kind integer; ditto for logical functions.
- Those kind parameters are (re)added to the module omp_lib and to the file omp_lib.h
Advantages:
- There is only one version of each OpenMP intrinsic functions, otherwise a compiler vendor had to create two versions
- The spec remains backwards compatible as OpenMP 3 had those parameters specified (albeit only for the module) and user programs might use the constants or interfaces based on the constants
* Kind numbers used for illustration purpose; while 4 and 8 are widely used, compiler with other kind numbers exists.