comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com (Tom Moran)
Subject: Re: Unreferenced lock variables
Date: 1999/04/20
Date: 1999-04-20T00:00:00+00:00	[thread overview]
Message-ID: <371cadb6.1137490@news.pacbell.net> (raw)
In-Reply-To: 7fi0uj$k99$1@nnrp1.dejanews.com

>> procedure Something(P : in integer) is
>>   Unused : integer := P/0;
>> begin ...

>> which can legally have Unused eliminated and thus the
>> divide by zero eliminated.  That certainly provides an
>> analogous precedent for eliminating the controlled
>> Initialize/Finalize.

>This is a bad analogy.
How about
type Back_Track_Type is array(integer range <>) of integer; 
function Big_Calculation(Distance:in integer; Time:in integer; ...)
return Back_Track_Type is  
   Speed : integer := Distance/Time;
   Where_it_was : Back_Track_Type(1 .. Time);
begin
   -- various calculations, some of which assume that the speed is
non-zero, but none of which actually mentions the variable "Speed"
  Granted, this would be poor programming, but the Distance/Time
calculation would give a divide by zero at the start of
Big_Calculation, while optimizing it away might result in erroneous
calculations that wouldn't show up till much later, in some other
place when it is surprisingly discovered that the back_track array
returned from the function was in fact null.  It seems to me that's a
closer analogy in terms of the difference in program behavior.




  reply	other threads:[~1999-04-20  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-11  0:00 Unreferenced lock variables Simon Wright
1999-04-11  0:00 ` Tom Moran
1999-04-12  0:00 ` Robert Dewar
1999-04-12  0:00   ` Simon Wright
1999-04-12  0:00     ` Robert Dewar
1999-04-12  0:00       ` Simon Wright
1999-04-14  0:00         ` Robert Dewar
1999-04-12  0:00       ` Jean-Pierre Rosen
1999-04-12  0:00         ` Simon Wright
1999-04-13  0:00         ` Robert Dewar
1999-04-13  0:00         ` Robert Dewar
1999-04-13  0:00       ` Tom Moran
1999-04-15  0:00         ` Robert Dewar
1999-04-15  0:00           ` Tom Moran
1999-04-16  0:00             ` Robert Dewar
1999-04-16  0:00               ` Tom Moran
1999-04-16  0:00                 ` Tucker Taft
1999-04-16  0:00                   ` Tom Moran
1999-04-19  0:00                     ` Tucker Taft
1999-04-16  0:00                   ` Tom Moran
1999-04-20  0:00         ` Tom Moran
1999-04-20  0:00           ` Robert Dewar
1999-04-20  0:00             ` Tom Moran [this message]
1999-04-21  0:00               ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox