Re: [Fwd: Compiling problems with HP-UNIX]

From: Michel Beland (beland@XXXXXX)
Date: Thu Oct 26 2000 - 08:46:45 MDT

  • Next message: Sharon Lai: "question about "hsvrgb""

    In ncarg-talk, you wrote:

    > The SAVE keyword is redundant in the f90 compilation under HP-UX and
    > most other compilers since about F66.

    This is not true. It might be redundant on compilers that used to
    consider everything static by default, but they are less and less
    frequent nowadays. In the old days, many programmers never wrote a SAVE
    statement, even when the algorithm required a variable to keep its value
    from one call of a subroutine to the next. They were saved (no pun
    intended) by the fact that all variables were static. Now, try to run
    this code on newer compilers and you might be forced to compile with an
    option to declare everything static, write SAVE in every subroutine or
    do a careful analysis to find out which variables really need to be
    saved.

    > I suggest either a glance at the man page on how to disable the
    > default setting or just editing the offending code and commenting out
    > the SAVE lines.

    If you comment out all the SAVE lines in subroutine NGDOTS, you
    introduce a bug, since IFIRST needs to be saved. You need to comment
    out only the one that saves IFIRST explicitely or the one that saves all
    variables provided you are sure that no other variable needs to be
    saved...

    > What the SAVE does is retain the the value of the variable between
    > calls to the function or subroutine. Looks like this function needs
    > to know if it's already been called so as not to do some
    > recalculations.

    That is the case for IFIRST, which is 0 on the first call and 1
    afterwards.

    -- 
    Michel Béland                 beland@CERCA.UMontreal.CA
    professionnel de recherche    tél: (514) 369-5223  fax: (514) 369-3880
    CERCA (Centre de recherche en calcul appliqué)
    5160, boul. Décarie, bureau 400(423), Montréal (Québec), Canada, H3X 2H9
    



    This archive was generated by hypermail 2b29 : Thu Oct 26 2000 - 09:18:37 MDT