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,54889de51045a215 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-13 01:32:37 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dmytrylavrov@fsmail.net (Dmytry Lavrov) Newsgroups: comp.lang.ada Subject: Re: += in ada Date: 13 Oct 2003 01:32:37 -0700 Organization: http://groups.google.com Message-ID: <49cbf610.0310130032.31e80aa7@posting.google.com> References: <3F7316F7.219F@mail.ru> <3F896BAB.6040804@comcast.net> <3F89F4E9.7050601@comcast.net> NNTP-Posting-Host: 213.248.15.47 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1066033957 24272 127.0.0.1 (13 Oct 2003 08:32:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 13 Oct 2003 08:32:37 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:761 Date: 2003-10-13T01:32:37-07:00 List-Id: "Robert I. Eachus" wrote in message .... to save or not to save. .... Here a:=a+b; ('a+=b') ,value of a should not be corrupted,because it may be needed to find what to do in case of exception! in a:=a+b it's simple to recover old value of a,but a:=a*b; here it's not so simple. Of course in your example are no difference: a:=b*c; here we ready to lost value of a and don't use a in expression,and normally(not in speculative examples) don't need to use a in case of exception.If we have exception handling for expression,normally this exception handler is a logically "part of expression",and normally may use all values from right side of :=,to find value for left side. > with Text_IO; use Text_IO; > with Integer_Text_IO; use Integer_Text_IO; > procedure Issue is > X,Y,Z: Integer := 0; > begin > Get(X); Get(Y); > if X * Y > Integer'Last > then > Put_Line("Overflow!"); > else > Z := X * Y; > Put_Line("Okay"); > end if; > exception when Constraint_Error => > Put("Exception Raised. Z = "); > Put(Z); > New_Line; > end Issue; What,there are exception in X * Y > Integer'Last if there are overflow on X*Y? And if so,how Put_Line("Overflow!"); could work? (yes ,i'm is a newbie to ada)