[J3] Inconsistent terminology in 18-007r1
Steven G. Kargl
kargl at uw.edu
Sun May 9 18:39:55 UTC 2021
On Sun, May 09, 2021 at 12:47:59PM +0900, Malcolm Cohen via J3 wrote:
> > Maybe this has already been fixed.
>
> Maybe there is nothing wrong.
>
>
> >3.49
> >default initialization
> ...
>
> > Shouldn't 3.49 mention the allocation status of allocatable components?
>
> No it should not. Default initialization does not affect allocatable
> components in any way.
Then the last sentence in 7.5.4.6(1) should be removed. It clearly
states that an allocatable component is initialized. To most programmers,
"initializing" an entity would mean assigning it a value (see for example
8.4 Initialization).
>
> > The sentence is 7.5.4.6(1) seems odd.
>
> No, the last sentence (Allocatable components are always initialized
> to unallocated.) is correct.
I disagree. Default initialization sets the allocation status of
the allocatable component to unallocated.
> > The last sentence should read as "The allocation status of an
> > allocatable component is unallocate."
>
> No it should not. It is correct as is. The suggested replacement
> is both ungrammatical
Whoops, sorry about dropping the 'd'. I suspect you understood
the intended edited. I guess this is a good way to derail a
discussion.
> and incorrect (the allocation status of an allocatable component
> is not always unallocated, it is merely initialized to be unallocated).
Well, no, I disgree. It is the allocation status of the allocatable
component that is set. The allocatable component has not been
initialized to any value. Elsewhere the Fortran Standard is
careful with the use of "allocation status".
5.4.10 Allocatable variables
1 The allocation status of an allocatable variable is either
allocated or unallocated. An allocatable variable becomes
allocated as described in 9.7.1.3. It becomes unallocated
as described in 9.7.3.2.
Interesting. 9.7.3.2 does not mention default initialization as
method to set the allocation status of an allocatable component
to unallocated. Ofi course, one has the wiggle room that an
allocatable component is not an allocatable variable based on
definitions in Section 3.
7.5.10 Construction of derived-type values
3 If a component with default initialization has no corresponding
component-data-source, then the default initialization is applied
to that component. If an allocatable component has no corresponding
component-data-source, then that component has an allocation status
of unallocated.
Should this be changed to "..., then that component is initialized to
unallocated."
> Perhaps this is not the best possible place to mention how
> allocatable components start out, as this is not “default”
> initialization but “always” initialization. But I think it
> is not completely unreasonable. An obvious alternative would
> be to have a new 5.4.2.x subclause for allocatable components,
> containing this statement and nothing else apart perhaps from
> waffle and references to other subclauses. Is that a good idea?
> Maybe, but I would not say it’s really necessary.
I think it be can fixed by changing the last sentence in 7.5.4.6(1)
from
Allocatable components are always initialized to unallocated.
to
The allocation status of an allocatable component is unallocated.
--
Steve
More information about the J3
mailing list