"Paddy O'Brien" <[log in to unmask]> wrote:
> I omitted to mention in my previous post that I do not understand this
> paragraph.
>
> [log in to unmask] wrote:
>
> <bits elided>
>
> > 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?
> Surely the bit pattern is maintained and the programmer can do devious
> things with this pattern. Not something that I would consider, but it
> does seem a possiblity.
If an integer is associated with a real, no matter whether by equivalence
or by different common declarations in different program units, and either
the integer or real "view" of it gets a value assigned, the other one has
the same bits, but they don't have an interpretation according to the
standard. That's what "undefined" means in standardese.
Processors have worked out ways to detect "undefinition" even for common.
For example, for each element of a common block (maybe at byte level),
there might be a "shadow" with bits that say "If you're looking at this
as though it's an integer, it's undefined" etc. If you store a real in
common in some program unit, the shadow flags for every byte storage
associated with the real are set to "real makes sense" and "nothing
else makes sense." Things are probably a bit more complicated to handle
the possibility of different parts of reals occupying the same byte,
for example, the flag may say "If this is the first byte of a real, it
makes sense, etc. When the processor examines a common variable, it
looks at the associated flag(s) to decide whether the whole variable is
defined. All this, of course, only if the "maximum run-time checking"
compile option was specified.
--
Van Snyder | What fraction of Americans believe
[log in to unmask] | Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or disapproved
by JPL, CalTech, NASA, Sean O'Keefe, George Bush, the Pope, or anybody else.
|