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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-02 09:12:41 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!newsfeed3.easynews.com!easynews.com!easynews!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 02 Mar 2004 11:12:40 -0600 Date: Tue, 02 Mar 2004 12:12:39 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: In-Out Parameters for functions References: <4020C947.81A6D703@0.0> <1075907239.138068@master.nyc.kbcfp.com> <402232E9.3EE15B4B@0.0> <1075987360.225622@master.nyc.kbcfp.com> <40236C0B.E988E003@0.0> <1077634311.254581@master.nyc.kbcfp.com> <1077718871.47635@master.nyc.kbcfp.com> <54cp3095jmv8s17h63d4bjdus0tec7l7pt@jellix.jlfencey.com> <1077721343.481619@master.nyc.kbcfp.com> <1077727853.904323@master.nyc.kbcfp.com> <1077810250.28474@master.nyc.kbcfp.com> <1078162736.111267@master.nyc.kbcfp.com> <8qW0c.24142$TF2.22229@nwrdny02.gnilink.net> In-Reply-To: <8qW0c.24142$TF2.22229@nwrdny02.gnilink.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <07mdndsdVakUXdndRVn-tA@comcast.com> NNTP-Posting-Host: 24.147.77.160 X-Trace: sv3-9OQq99Q6yak/TZs0qFv/w1vvRyTw1P4p+EmurZ6/PVj7mqRi1u2izLXa8zq1DYbW6099djJfImmlxg3!Mc8lkY+LVGB/PLH6mpN8FzED9OHJjIy9ftqyMjBpPkCehJw7pFj216U1sg9N7A== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:6010 Date: 2004-03-02T12:12:39-05:00 List-Id: Hyman Rosen wrote: > The same section says > "The permissions granted by this clause can have an effect on the > semantics of a program only if the program fails a language-defined > check." > > So unless you're coding in a way where you expect to cause and catch > l-d checks, it won't matter. Exactly correct. But I do write code that deals with Constraint_Error, and has to do so correctly--whatever that means in that particular library. > Also, if I read that section correctly, in a sequence of code like this > a := 0; > b := c + d; > e := f + g; > h := i + j; > a := 1 / a; > it is possible that only the assignment to a will have occurred when the > exception handler from the division by zero is executed, is that correct? > Doesn't that make catching failures of language-defined checks useless? > You will know that something bad happened, but you won't know which objects > in your program are abnormal. In fact for this sequence the compiler can generate code that does no assignments and always raises Constraint_Error. I wrote a little program: with Ada.Text_IO; use Ada.Text_IO; procedure Hyman_Example is A,B,C,D,E,F,G,H,I,J: Integer := 1; begin begin a := 0; b := c + d; e := f + g; h := i + j; a := 1 / a; exception when Constraint_Error => Put_Line("Constraint_Error Raised. a = " & Integer'Image(A) & " b = " & Integer'Image(B) & " e = " & Integer'Image(E) & " h = " & Integer'Image(H)); end; end Hyman_Example; And was actually surprised that GNAT didn't give me a warning and do just that. I suspect that GNAT was being 'nice' because it saw a declare block there to handle Constraint_Error. I could try making the declare block a library unit procedure and see what happens. -- Robert I. Eachus "The only thing necessary for the triumph of evil is for good men to do nothing." --Edmund Burke