🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2318

Re: F90 vs C++/C, optimization question?

#2318
From: William B. Clodius
Date: Thu, 26 Oct 1995 23:20
39 lines
2487 bytes
A few comments on comments on this question, mostly derived from David
Chase's remarks.

1.  Legal Fortran code is allowed to have arguments aliased with one
another and global (common and module) variables.  Legal code cannot have
the aliased variables be modified.

2.  It should be noted that Fortran is not the only language where
optimizers are explicitly allowed to assume no aliasing.  Ada, which is
generally considered to have some of the safest semantics of any commonly
used language, has the same semantics.

3.  Having the semantics of the code well defined as written, does not mean
that the semantics are well defined for the user of the code.  As a silly
example, a C routine written to reverse the order and interchange two
arrays of the same size may have a well defined result to the writter of
the code, but if a hypothetical (foolish) user attempts to use this code to
reverse the order of an array by using pointers to the array as both
arguments to the routine, the user on completion may find that the array is
not reversed, or the first half of the array is replaced by the second half
of the array and the second half is unchanged, or ..., depending on the
details of the algorithm.  In this case information hiding, the goal of
most modern languages, bites the foolish user.  Similar problems can and
will occur for more realistic examples.  Every user of code, in any
language, should be extremely careful in using aliased arguments that can
be modified.

 William B. Clodius             Phone (505) 665-9370
 Los Alamos Natl. Lab. NIS-1    FAX (505) 665-7395
 PO Box 1663, MS-D466           Group Office (505) 667-2701
 Los Alamos, NM 87545           email wclodius@lanl.gov

 NIS-1: Nonproliferation and International Security Div./
        Space and Atmospheric Physics Group


[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <46p53m$dq@engnews2.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: wclodius@lanl.gov (William B. Clodius)
Newsgroups: comp.std.c++
Subject: Re: F90 vs C++/C, optimization question?
Date: 26 Oct 1995 23:20:22 GMT
Organization: ?
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <46p53m$dq@engnews2.Eng.Sun.COM>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text/plain; charset="us-ascii"
Originator: clamage@taumet