(j3.2006) 5.4.7p2 goes a little bit too far
Malcolm Cohen
malcolm
Mon Jul 22 03:30:12 EDT 2013
>Perhaps 5.4.7p2 ought to be
>
>"If a nonpointer variable has default initialization, it shall not
>appear in a <data-stmt-object-list>."
Sounds like a reasonable editorial correction.
>F08/0062 established that it would be onerous to require a processor to
>initialize part of an object using default initialization and part using
>explicit initialization in a DATA statement. I interpreted this to mean
>"some components of...," not "some array elements of...," since that's
>how Tobias posed the question.
Sorry, I do not see how an F2008 interpretation asked in 2012 "established" what
we intended in Fortran 95. Nor do I see how over-interpreting the wording of
that explanation is likely to lead to good things. Obviously an array element
is "part of" an array object...
> A question Tobias didn't ask was whether
>we intended to prohibit this:
>
> type(t) :: B(3)
> data B(2) / t(2,39.0) /
>
>which doesn't impose the burden contemplated by F08/0062.
Well it does impose essentially the same burden, and does violate the first
sentence of the explanation. F08/0062 is not the standard, nor is the
explanation normative text.
One might conjecture that asking this question with an array element would get
precisely the same response as asking with a component: it is not conforming and
we did it deliberately, to reduce the burden on the processor.
...
>"If a type has default initialization, a subcomponent of a variable of
>that type shall not appear in a <data-stmt-object-list>."
>
>This is, after all, the reasoning behind the answer to F08/0062.
I don't think so. The reasoning behind the answer to F08/0062 is that the
standard says the program is invalid, and that we deliberately wrote the words
to make it invalid - it was not inadvertant nor is it inconsistent or ambiguous.
>Since we have decided to sit on our hands for seven years or so,
I don't think making statements like this bolsters the case.
You already have have an apparently-reasonable case that there is an
inconsistency between what one can do with DATA statements and initialization in
type declaration statements, so I feel confident that you will put it forward to
J3 for consideration whether it has a sufficiently positive cost-benefit
analysis to raise it with WG5. OTOH if we're going to remove the wart, I see
little benefit in removing only a part of it; that is, removing the prohibition
altogether would be my recommendation if we are to do it at all.
Cheers,
--
................................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3
mailing list