From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7f1e0b399cd01cb0 X-Google-Attributes: gid103376,public From: tmoran@bix.com (Tom Moran) Subject: Re: Unreferenced lock variables Date: 1999/04/20 Message-ID: <371cadb6.1137490@news.pacbell.net>#1/1 X-Deja-AN: 468778588 References: <7ero31$n46$1@nnrp1.dejanews.com> <7esrmv$k1n$1@nnrp1.dejanews.com> <3713b417.22324981@news.pacbell.net> <3718268c.48395643@news.pacbell.net> <7fi0uj$k99$1@nnrp1.dejanews.com> X-Complaints-To: abuse@pacbell.net X-Trace: typhoon-sf.pbi.net 924627013 207.214.211.114 (Tue, 20 Apr 1999 09:50:13 PDT) Organization: SBC Internet Services NNTP-Posting-Date: Tue, 20 Apr 1999 09:50:13 PDT Newsgroups: comp.lang.ada Date: 1999-04-20T00:00:00+00:00 List-Id: >> 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.