Re: Fortran

From: Richard Maine (nospam_at_see.signature)
Date: 12/19/03

  • Next message: Douglas Cox: "Code update for g95"
    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
    

  • Next message: Douglas Cox: "Code update for g95"

    Relevant Pages

    • Re: Formatting a real with an I edit descriptor.
      ... can do this in a standard way with the transferintrinsic. ... equivalence statement. ... (Well I think this is nonstandard. ... The compiler could detect the undefined case as an error and report ...
      (comp.lang.fortran)
    • Re: Formatting a real with an I edit descriptor.
      ... Others have commented about what "correct" might mean with a nonstandard ... and modintrinsics, they all do similar but different things. ... can do this in a standard way with the transferintrinsic. ... equivalence statement. ...
      (comp.lang.fortran)
    • Re: Non-standard arithmetic
      ... is that the usual rules of arithmetic apply to the nonstandard ... the standard elements and nonstandard (infinite) elements. ... The intended interpretation of the Peano Axioms is that the variables ...
      (sci.logic)
    • Re: Case sensitivity
      ... It is common practice, that goes from early 90's or even further ... environmental dependency on case-insensitive. ... and declaring that one or the other is nonstandard won't help. ... supposed to write standard code, ...
      (comp.lang.forth)
    • Re: <ctype.h> toLower()
      ... > If it's a free standing implimentation, then the scope of the standard is ... I am talking about the compiled object code when I mean ... advantages of object code far outweigh source code in terms of portability. ... > you compile it with a hosted implimentation for that platform). ...
      (alt.comp.lang.learn.c-cpp)

    Loading