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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1e4bb63e08046e1a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-29 18:51:10 PST Path: archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsswitch.lcs.mit.edu!newsfeed.mathworks.com!oleane.net!oleane!freenix!enst.fr!not-for-mail From: "Steven Deller" Newsgroups: comp.lang.ada Subject: RE: In case statment? (was Re: is exception when others => null; smart?) Date: Tue, 29 Oct 2002 20:52:45 -0600 Organization: Smooth Sailing LLC Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1035946262 41870 137.194.161.2 (30 Oct 2002 02:51:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 30 Oct 2002 02:51:02 +0000 (UTC) Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 In-Reply-To: <1b585154.0210291023.70af4929@posting.google.com> Importance: Normal Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:30211 Date: 2002-10-29T20:52:45-06:00 Peter, I'd bet it also depends on optimization. At least for Rational, using the "for" clauses is tantamount to saying "I know the values at this location are ok, so just use them". A 'valid could be used to test, but otherwise, Rational opts to not test. And the "when others" is, as expected, a last ditch if the first two compares fail. You might change your code to do something like: c : boolean ... begin begin c := b ; exception when others => text_io.put_line "yet another possibility" ; end ; case b is ... And you might test at different optimization levels. At level 0, Rational may very well include a constraint check on b that is, at higher optimizations, optimized away per RM permissions. Regards, Steve > -----Original Message----- > As the following example illustrates, it really depends upon > the compiler too. A "bad" value is handled differently as > shown: > ----------------------------------------------------------- > with system; > with text_io; > procedure test is > > a : character := character'val(2#11111111#); > for a'size use 8; > b : boolean; > for b'address use a'address; > for b'size use 8; > > begin > > case b is > when true => > text_io.put_line ("b is true"); > when false => > text_io.put_line ("b is false"); > when others => > text_io.put_line ("ObjectAda for Windows V7.1.105 " & > "professional " edition gets here, " & > "and so does Rational Apex Ada 95 > v. 4.0.0b"); > end case; > > exception > when others => > text_io.put_line ("Gnat 3.14P gets here "); > end test; >