(j3.2006) Problem with default expressions for kind type parameters?
Van Snyder
Van.Snyder
Fri Sep 21 22:01:19 EDT 2012
On Fri, 2012-09-21 at 21:52 -0400, Rafik Zurob wrote:
> ! Note to self: don't specify a value for double_k explicitly
> type dt(k, double_k)
> integer, kind :: k = 4, double_k = 2 * k
> real(k) s
> real(double_k) d
> end type
> type(dt) d1 ! real(4), real(8)
> type(dt(4)) d2 ! real(4), real(8)
> type(dt(8)) d3 ! real(8), real(16)
In 04-162, I advocated allowing parameters, i.e., named "constant"
declarations, inside type definitions. For the above, instead of "note
to self," one would have
type :: dt ( k )
integer, kind :: k = kind(0.0e0)
integer, parameter :: dk = selected_real_kind(digits(0.0_k)+1)
real(k) :: s
real(dk) :: d
end type
More information about the J3
mailing list