Re: Fortran
From: Richard Maine (nospam_at_see.signature)
Date: 12/19/03
- Previous message: glen herrmannsfeldt: "Re: Fortran"
- In reply to: glen herrmannsfeldt: "Re: Fortran"
- Next in thread: David Frank: "Re: Fortran"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 18 Dec 2003 17:04:15 -0800
(I've replied only to comp.lang.fortran because my comments only
relate directly to Fortran, though glenn did have some relevant to
both groups).
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:
>>>One of the favorite uses for EQUIVALENCE is to map variables of
>>>different types onto the same storage, so that a value can be
>>>stored as one type, and the bits retrieved as a different type.
...
> The F66 standard says something like the value is undefined. That
> may be slightly different from illegal. It is at least undefined
> in that the storage formats for different types are not fixed by
> the standard, so any such use will not be portable.
Yes, the distinctions between things like illegal (or more
properly nonstandard), processor-dependent, and undefined, can be
subtle.
If something is nonstandard, then all bets are off. It might not
even compile. For example, equivalencing character and noncharacter
variables is nonstandard and indeed won't compile at all with some
compilers.
If something gives a processor-dependent result, then it ought to
be a valid value (possibly including such things as NaNs if
applicable). The standard just doesn't say what value it is.
Something can cause a variable to become undefined, which is
perfectly standard-conforming as long as you don't subsequently
reference the undefined variable (in which case, the program
becomes nonstandard).
And there at least used to be a few things (or maybe they were just in
some nonfinal drafts - I don't recall) that were said to be
standard-conforming, but the effect (not just the result value) of
doing them was processor-dependent. I'm not sure that I've ever
managed to quite extract the practical difference between this and
being nonstandard. Seems to me that in both cases, anything can
happen. I couldn't point you to the exact places where this kind of
things was specified. Perhaps I'm thinking of some of the early
drafts of VOLATILE, which seemed to me to say that the standard had a
feature spelled VOLATILE, but if you actually used it, your whole
program was nonstandard anyway - catch 22.
-- Richard Maine | Good judgment comes from experience; email: my first.last at org.domain | experience comes from bad judgment. org: nasa, domain: gov | -- Mark Twain
- Previous message: glen herrmannsfeldt: "Re: Fortran"
- In reply to: glen herrmannsfeldt: "Re: Fortran"
- Next in thread: David Frank: "Re: Fortran"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|