Re: fortran question

From: Gib Bogle (bogle_at_ihug.too.much.spam.co.nz)
Date: 02/27/05

  • Next message: Patrick Thrapp: "Re: fortran question"
    Date: Sun, 27 Feb 2005 13:50:00 +1300
    
    

    *** Hendrickson wrote:

    >
    >
    > djlmunoz@gmail.com wrote:
    >
    >> One common use of Fortran's Equivalence is the following: A large
    >> array of numeric values is made available to a subprogram as a
    >> parameter. The array contains many different unrelated variables,
    >> rather than a collection of repetitions of the same variable. It is
    >> represented as an array to reduce the number of names that need to be
    >> passed as parameters. Within the subprogram, a lengthy Equivalence
    >> statement is used to create connotative names as aliases to the various
    >> array elements, which increases the readability of the code of the
    >> subprogram. Is this a good idea or not. What alternatives to aliasing
    >> are available?
    >>
    >
    > You can't do this in standard Fortran. If by "parameter"
    > you mean argument, then you can't equivalence to it. Some
    > compiler might allow it as an extension, but you can't
    > count on it.
    >
    > A more modern way (since 1990 or so) is to use a module.
    > module my_numbers
    > real, parameter :: pi = 3.14
    > real, parameter :: 2 = 2.718

    Does this line do what it appears to do (redefine the constant 2 to 2.718)?

    Gib


  • Next message: Patrick Thrapp: "Re: fortran question"