Open
Description
It has so far been impossible to write user defined functions that can mimic the behavior of various intrinsic functions. I.e.
function real(A, KIND)
real, intent(in) :: A
integer, intent(in) :: KIND
real(KIND) :: real
end function
But if we had some mechanism to define a constant expression value that must be one of the arguments we could do it. I.e. some suggestive syntax
interface real
module function str_to_real128(A, KIND, STAT)
character(len=*), intent(in) :: A
integer, parameter, intent(in) :: KIND = real128
integer, intent(out), optional :: STAT
real(real128) :: str_to_real128
end function
...
end interface
...
real(real128) :: my_val
my_val = real("1.234", KIND=real128)
Metadata
Metadata
Assignees
Labels
No labels