kind(x): Kind of an Entity

Kind of an entity.

Declaration

Sintaxe

retval = kind(x)
integer function kind(x)

Argumentos

x the input value, can be logical, integer, real, complex, or character. It may be a scalar or array valued i.e., any intrinsic type.

Valores de retorno

The return value is of integer type and of default integer kind.

Descrição

kind(x) returns the kind parameter of the input argument x.

Tipos

Supported argument types are logical, integer, real, complex, or character.

module lfortran_intrinsic_kind
implicit none
contains

integer function kind(x) result(r)
logical(4), intent(in) :: x
r = 4
end function

integer function skind(x) result(r)
real(4), intent(in) :: x
r = 4
end function

integer function dkind(x) result(r)
real(8), intent(in) :: x
r = 8
end function

integer function lkind(x) result(r)
logical(4), intent(in) :: x
r = 4
end function

end module

Exemplos

program intrinsics_kind
    use lfortran_intrinsic_kind, only: kind
    implicit none
	logical :: l4d
	logical(4) :: l4
	print *, kind(l4d)
	print *, kind(l4)
end program

Resultado:

4
4

Veja Também

Nenhum.