Re: Component Initialization of Module Variables
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Wed, 4 Mar 2009 11:49:23 -0800
mecej4 <mecej4@xxxxxxxxxxxxxxxxx> wrote:
On Mar 4, 3:50 pm, Janus Weil <jaydu...@xxxxxxxxxxxxxx> wrote:[code elided]
This is rejected by g95 with
Error: Module variable 'tve' at (1) with a component
initialization must have the SAVE attribute
To a normal user
who does not worry about how the compiler would go about
implementing the attributes, the error message would appear to be
a compiler bug.
I don't see that. I have elided all the other material, including quotes
from the standard and from textbooks, leaving just the error message as
I'd expect a "normal user" to see it, not surrounded by reference
materials.
I don't see anything in it that hints at compiler bug. In fact, I'd say
that the message seemed admirably clear to me. The variable in question
has "component initialization", which isn't a term used in the standard,
but is to me an eminently more obvious term. That's the initialization
of the components, which you can see right there in the type definition.
The details of when and why the initialization applies aren't obvious,
but that's much more for the language lawyers. I would think it obvious
to even the most casual of readers that "component initialization"
probably had to do with the initialization of the components,
particularly since the type in question has such.
And the message says that the variable must have the SAVE attribute.
What about that brings compiler bug to mind?
Finding different behaviors in different compilers is something that I'd
agree can at least raise the question, but that's not a fault of the
error message.
And, the fact that one compiler signals 'error'
and another 'warning' suggests that it may be not an easy feat to
extract the rules from a standards documents,
I'm going to disagree with that as well. Oh, I agree that the standards
documents can be hard to read. But I don't at all agree that having one
compiler signal an error where another signals a warning suggests that
at all. To the contrary, it suggests to me that both compiler writers
read the standard in exactly the same way. The difference I see is that
one choose to allow the practice anyway as an extension. Messages about
extensions are normally warnings unless one uses compiler switches to
deliberately change them to errors.
--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
.
- Follow-Ups:
- Re: Component Initialization of Module Variables
- From: James Van Buskirk
- Re: Component Initialization of Module Variables
- References:
- Component Initialization of Module Variables
- From: Janus Weil
- Re: Component Initialization of Module Variables
- From: michaelmetcalf
- Re: Component Initialization of Module Variables
- From: Richard Maine
- Re: Component Initialization of Module Variables
- From: mecej4
- Component Initialization of Module Variables
- Prev by Date: Re: Monte Carlo computation of PI with license numbers
- Next by Date: PI day, and other days of the year.
- Previous by thread: Re: Component Initialization of Module Variables
- Next by thread: Re: Component Initialization of Module Variables
- Index(es):
Relevant Pages
|