On Jan 16, 2006, at 6:05 AM, Aleksandar Donev wrote:
For one aspect of an answer to the OP's question, I recall a previous
discussion in J3 of exactly the same question along the following
lines:
Default initialization is something that happens locally in a scoping
unit written in Fortran. It cannot be detected globally whether
something was default initialized or not. A Fortran program can
perfectly well take a default initialized variable and do something to
make it s components defined with a different value or even undefined.
(Sorry, Aleksander, but of course it is trivially possible for default
initialized components to get undefined. You are confusing issues here.
They start out with their initialization, but nothing magically
overrides all the many ways that they can subsequently become
undefined. A few of the items in the long list in c16 have exceptions
for default initialization, but by no means all, or even most of them).
Likewise, a variable that is not default initialized could get its
components defined.
Thus, the fact that a type does or does not have default initialization
is not inherently a bar to interoperability. A C function can still do
exactly the same kinds of things with variables of the type as a
Fortran procedure can. Yes, the C code to get the same effect looks
different, but then it looks different in quite a lot of ways. :-)
Anyway, that's the way I recall the discussion.
Oh yes, to further illustrate the issue, look at default initialization
in SEQUENCE types. (I've long thought that BIND(C) should have been
referred to as a special kind of SEQUENCE, since pretty much everything
about SEQUENCE also applies to BIND(C). If you find something that
mentions sequence, but not bind(c), odds are that it is an error. I
found several such things in drafts of the standard; all the ones I can
recall are fixed by now.)
Two sequence types can have different default initializations and still
count as the "same" type (for purposes of 4.5.1.3). This doesn't cause
havoc; the default initialization for a particular variable in a
particular scoping unit comes from only one copy of the definition; it
doesn't matter that different default initialization might happen in
different scoping units. (I really advise against doing things like
that, but it is well-defined from a standard's point of view).
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|