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 autolearn=ham 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-30 00:58:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fr.usenet-edu.net!usenet-edu.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.ulv.nextra.no!nextra.com!uio.no!newsfeed.song.fi!nntp.inet.fi!central.inet.fi!inet.fi!read2.inet.fi.POSTED!not-for-mail From: "Anders Wirzenius" Newsgroups: comp.lang.ada References: <3DB8204B.2080804@attbi.com> <3DB89B83.2060609@acm.org> <1b585154.0210291023.70af4929@posting.google.com> Subject: Re: In case statment? (was Re: is exception when others => null; smart?) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Wed, 30 Oct 2002 08:58:10 GMT NNTP-Posting-Host: 194.251.142.2 X-Trace: read2.inet.fi 1035968290 194.251.142.2 (Wed, 30 Oct 2002 10:58:10 EET) NNTP-Posting-Date: Wed, 30 Oct 2002 10:58:10 EET Organization: Sonera corp Internet services Xref: archiver1.google.com comp.lang.ada:30219 Date: 2002-10-30T08:58:10+00:00 List-Id: "Peter Richtmyer" wrote in message news:1b585154.0210291023.70af4929@posting.google.com... > 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; > --------------------------------------------------------------- But if you move the assignment to after begin, the Gnat behaviour changes: ... a : character; for a'size use 8; b : boolean := false; for b'address use a'address; for b'size use 8; begin a := character'val(2#11111111#); ... and the program execution ends up under when others => Anders