The Fortran standards are careful to require that default integer and
default real occupy the same space. Notwithstanding that gurus have
warned nearly forever that games involving storage association between
integer and real are bad ideas, some programs still depend on it. So if
we do anything to make it easier to declare variables and function results,
and specify literals, we should make a distinction between default and
what-you-get-if-you-don't-say-anything. The word "implicit" as opposed to
"default" comes to mind, but that's a spelling detail that could be resolved
at the last minute. No matter what you call it, however, it would be
difficult to get the default kind after you specify the meaning of
what-you-get-if-you-don't-say-anything. For purposes of illustration,
suppose we were to extend the IMPLICIT statement:
IMPLICIT :: KIND(REAL) = KIND(0.0d0)
Then, thereafter, if you say KIND(0.0) you get the same value as KIND(0.0d0),
because the "0.0" is implicitly "0.0d0".
One way around this is to have named constants in ISO_FORTRAN_ENV for
the default kinds for all intrinsic types, and for double precision (just
for completeness). Then you could say, e.g. 0.1_default_real_kind. There
was a proposal at meeting 167 to put arrays of kind type parameters for
all intrinsic types into ISO_FORTRAN_ENV. If we do that, and specify that
the default is in a particular place, say the first element, that would
work, too. For REAL, I'd say the default is the first one and double
precision is the second one. There would be some tedium involved, to get
a scalar named constant having the same value, to be used in a literal.
OTOH, we could extend the syntax of the kind thing-o in a literal to allow
initialization expressions instead of names. One could then write something
such as 0.1_real_kinds(1) to get default real and 0.1_real_kinds(2) to get
double precision.
--
Van Snyder | What fraction of Americans believe
[log in to unmask] | Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or disapproved
by JPL, CalTech, NASA, Sean O'Keefe, George Bush, the Pope, or anybody else.
|