On Tue, 16 Dec 2003 00:45:10 -0500, Peter Shenkin <[log in to unmask]>
wrote:
>On Mon, 15 Dec 2003, 8:41pm -0800, [log in to unmask] wrote:
>> 30 years ago, the Fortran standard did suggest that integers and reals
>> should occupy the same storage space. When you have millions of lines of
>> code from that era which still work, hardware which fits that model has its
>> uses. I don't know that any particular compiler was in question.
>
>If I'm not mistaken, the standard *required* (not "suggested") it,
>and still does.
If there is a type mismatch, it doesn't say what happens. So wouldn't it
be valid if an implementation stored integers and reals in separate
physical spaces so long as it observed transitive storage relationships?
So the following code
INTEGER I(100)
REAL X(100), Y(50)
EQUIVALENCE (I(i), X)
EQUIVALENCE (I(51), Y)
Y(1) = 123.
Would set X(51) to 123., but its effect on I(51) would be undefined.
And the following:
INTEGER I(100)
REAL X(25), Y(25)
EQUIVALENCE (I(1), X)
EQUIVALENCE (I(76), Y)
Could be implemented as if there were no equivalences at all.
--
Jim Riley
|