Paddy O'Brien writes:
> [log in to unmask] wrote:
> > If a variable becomes storage associated with another variable that has
> > different type -- either by equivalence or common, assigning to one causes
> > the other to become undefined, atleast in the sense that the value has a
> > meaning defined by the standard.
> >
> If the routines are in different files, how does the compiler know?
You misunderstand what "undefined" means in Fortran. This is a
quite common misunderstanding, not one unique to you...but it is
a misunderstanding.
The compiler doesn't have to know. The compiler *NEVER* has to
know about something becoming undefined. When the standard says
that something becomes undefined, that implies restrictions on
the programmer. It never implies restrictions on the compiler.
If someone uses "compiler has to" or similar concepts in the
same sentence as "undefined", then they probably missed the
point.
Indeed, often the whole point of saying that something becomes
undefined is to allow the compiler to do whatever it wants in those
cases. The programmer is then forbidden from doing anything that
can tell which choice the compiler made (I'm speaking very loosely
here, but that's the general idea).
Note also that if the programmer violates these rules, the standard
doesn't say that the compiler has to detect this error. It just
means that the cde is nonstandard, and thus that the compiler
can do whatever it wants with the code.
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|