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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable 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 02:36:19 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!oleane.net!oleane!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: christoph.grein@eurocopter.com Newsgroups: comp.lang.ada Subject: Re: += in ada Date: Mon, 13 Oct 2003 11:22:23 +0200 (MET DST) Organization: Cuivre, Argent, Or Message-ID: Reply-To: grein@egypt.otn.eurocopter.de NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1066037778 56447 80.67.180.195 (13 Oct 2003 09:36:18 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 13 Oct 2003 09:36:18 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: dKHhdNiV7NDRV2Wwe80VMA== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:770 Date: 2003-10-13T11:22:23+02:00 > > 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 X and Y may be kept in registers and also the result, and the registers may well be able to hold values above Integer'Last. The RM specifies that either an exception be raised or the mathematically correct result (here Boolean True) be returned. [Only when the result is assigned to an Integer must the exception be raised. There is no assignment in the if-statement's expression.] > > 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)