Tom Clune wrote:
> Thanks Steve.
>
> Has this been true since F95? (Only if you happen to know off the top
> of your head.)
Yes. 14.7.5 of F95 contains:
(19) Invocation of a procedure that contains a nonsaved local object
that is not a dummy argument, is not accessed by use or host
association, has neither the ALLOCATABLE nor POINTER attribute, and is
of a derived type in which default initialization is specified for any
direct components, causes those components of the object to become
defined.
Cheers,
John.
>
> - Tom
>
>
>
> On Apr 1, 2015, at 4:09 PM, Lionel, Steve <[log in to unmask]
> <mailto:[log in to unmask]>> wrote:
>
>> Tom.
>> Default initialization of derived type components is not the same as
>> variable initialization. Each time “bar” is entered, the local
>> variable gets initialized with the default component values, if any.
>> See F2008 16.6.5 (23):
>> (23) Invocation of a procedure that contains an unsaved nonpointer
>> nonallocatable local variable causes all nonpointer
>> default-initialized subcomponents of the object to become defined.
>> Item (24) is also of interest, though not to your example. Also see
>> 4.5.4.6.
>> Steve
>
> Thomas Clune, Ph. D. <[log in to unmask]
> <mailto:[log in to unmask]>>
> Head ASTG,Code 606
> NASA GSFC
> MS 610.8 B33-C128
> Greenbelt, MD 20771
> 301-286-4635
>
>
>
>
>
>
>
>
>
|