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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 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-30 05:28:36 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!wn12feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: In case statment? (was Re: is exception when others => null; smart?) Date: Wed, 30 Oct 2002 08:28:27 -0500 Organization: MindSpring Enterprises Message-ID: References: <3DB8204B.2080804@attbi.com> <3DB89B83.2060609@acm.org> <1b585154.0210291023.70af4929@posting.google.com> NNTP-Posting-Host: d1.56.b6.5e X-Server-Date: 30 Oct 2002 13:28:35 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Xref: archiver1.google.com comp.lang.ada:30226 Date: 2002-10-30T13:28:35+00:00 List-Id: Well, one excuse for always having a "when others" in a case statement might be that you anticipate additions to the enumerated type driving it and you want the code to take come appropriate action if it gets a new, unknown value. If you never use a "when others", you get the advantage that perhaps the compiler or runtime will catch inadvertent errors. If you always use "when others" you get the advantage of a built in accommodation for a software fault. Its an engineering tradeoff so "never" and "always" don't seem to really apply. It depends on the nature of the system and the consequences of hitting a case statement with a value not covered. MDC -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jast.mil/ Send Replies To: m c o n d i c @ a c m . o r g "I'd trade it all for just a little more" -- Charles Montgomery Burns, [4F10] ====================================================================== Peter Richtmyer wrote in message news:1b585154.0210291023.70af4929@posting.google.com... > Robert A Duff wrote in message news:... > > I find this topic somewhat amusing because my previous employer > required a "when others" on ALL case statements, even when > all values were covered by the "when" clauses. My current job > requires us to specify all cases, and we are not allowed to > put a "when others" clause in. >