Re: In-Out Parameters for functions
From: Hyman Rosen (hyrosen_at_mail.com)
Date: 01/29/04
- Previous message: Georg Bauhaus: "Re: Standard Ada Preprocessor (conclusions)"
- In reply to: David Starner: "Re: In-Out Parameters for functions"
- Next in thread: Georg Bauhaus: "Re: In-Out Parameters for functions"
- Reply: Georg Bauhaus: "Re: In-Out Parameters for functions"
- Reply: David Starner: "Re: In-Out Parameters for functions"
- Reply: Robert I. Eachus: "Re: In-Out Parameters for functions"
- Reply: Dmitry A. Kazakov: "Re: In-Out Parameters for functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Jan 2004 14:46:22 -0500
David Starner wrote:
> Why should buggy code work?
I don't think you understand. As Ada stands now, it is perfectly
legal to write code which has unspecified results due to order of
execution. In general, the compiler cannot know whether particular
code has such order dependencies or not, and so cannot reliably
warn of such uses. Therefore, it's possible for such code to slip
undetected into production, and to survive testing because the
order chosen by the compiler is the "correct" one. Then some change
occurs in the environment, such as changing optimization level,
or changing platform, and now the compiler makes a different choice
and the code stops working.
You cannot make the argument that raesonable care would prevent this.
That is the same argument that C programmers make for the compiler not
checking array bounds or pointer access, and Ada proponents roundly
reject such arguments.
Therefore, the best thing to do is to eliminate the lack of specificity,
so that a line of code will be executed in the same order always. Once
this is in place, then depending on the order of evaluation within an
expression will be no more problematic than depending on the order of
execution of a pair of statements, and will not be "buggy". As for its
utility, I submit that code like this:
Point p := (x => ReadCoord, y => ReadCoord, z => ReadCoord);
is perfectly sensible once you forget that order of evaluation was ever
an issue and accept left-to-right as the natural way of things. Why is
this statement any worse than
cx, cy, cz : Coord := ReadCoord;
Point p := (x => cx, y => cy, z=> cz);
- Previous message: Georg Bauhaus: "Re: Standard Ada Preprocessor (conclusions)"
- In reply to: David Starner: "Re: In-Out Parameters for functions"
- Next in thread: Georg Bauhaus: "Re: In-Out Parameters for functions"
- Reply: Georg Bauhaus: "Re: In-Out Parameters for functions"
- Reply: David Starner: "Re: In-Out Parameters for functions"
- Reply: Robert I. Eachus: "Re: In-Out Parameters for functions"
- Reply: Dmitry A. Kazakov: "Re: In-Out Parameters for functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|