Print

Print


Yasuki Arasaki wrote:

> I agree with the rest of the post, but isn't it the Lahey compiler
> that's right and not NAG?
> The save in
>  type (xy), save :: a = xy(2)
Oh, sorry, I was responding to the question in the post and assumed that 
there was no initialization, but rather only default initialization. 
Here there is both, and the standard basically says the (explicit). 
initialization overrides the default one.

> Here's what the standard says:
...
> -----
>   The presence of initialization implies that object-name is saved,
...
>   Unlike explicit initialization, default initialization does not imply
>   that the object has the SAVE attribute.
...
>    If an object of a type for which component-initialization is
>    specified (R444) appears in the specification-part of a module and
>    does not have the ALLOCATABLE or POINTER attribute, the object shall
>    have the SAVE attribute.
> -----
> Taken together I think that means a default-initialized object in a
> module needs to be given the SAVE attribute either implicitly by
> (explicit, not default) initialization or explicitly by writing SAVE.
I agree, SAVE is implied here.

Thanks,
Aleks