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-24 16:00:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.bredband.com!bredband!newsspool1.bredband.com!news1.bredband.com.POSTED!not-for-mail From: "Per Sandbergs" Newsgroups: comp.lang.ada References: Subject: 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: Thu, 24 Oct 2002 16:38:17 +0200 NNTP-Posting-Host: 213.114.165.150 X-Complaints-To: news-abuse@bredband.com X-Trace: news1.bredband.com 1035470297 213.114.165.150 (Thu, 24 Oct 2002 16:38:17 CEST) NNTP-Posting-Date: Thu, 24 Oct 2002 16:38:17 CEST Organization: A customer of B2 Bredbandsbolaget (www.bredband.com) Xref: archiver1.google.com comp.lang.ada:30116 Date: 2002-10-24T16:38:17+02:00 List-Id: Hi, In general i find use of "when others => xxx" dumb especialy if xxx is null since this as a general is ment to be a last resort to catch unexpected events and report them. My opinion about "when others => xxx" is that is may be used in the folowing situations. 1) main_loop: loop begin lots of operations. exception when others => report the error and reset top a safe state in order to continue. end loop; 2) function work_is_ok(fool) return boolean is begin some computations exception -- when others => return false; -- or report error and eventualt raise. end; 2) procedure must_not_raie(fool) is begin some computations exception when others => null; end; So when others => null is only to be used when you are expecting the unexpected. I wont be supprised if other peoplen are of different opinion but after integration a number of large systems i find the above aproach "wise". /Regards /Per "Preben Randhol" randhol+news@pvv.org wrote in message news:slrnarfvcc.4ud.randhol+news@kiuk0152.chembio.ntnu.no... > Hi > > As Emacs (ugg!) got installed when I had to reinstall Debian due to a > hard disc crash, I thought I'd have a look at the ada-mode before > uninstalling Emacs. > > Now I'm in the process of making a ada-mode for vim (currently called: > am - Ada in the Morning) which will have much of the functionality of > the ada-mode for Emacs. > > However there is one thing with ada-mode which I don't know is what I > want: > > If you choose to generate a body for a procedure or a function then you > get this: > > procedue Proc > is > > begin > > exception > when others => null; > end Proc; > > My question is: Is this smart? I mean won't you then automatically mask > all the potential problems you might get at run-time so that you won't > see errors in the code during testing? I can see that it might also have > advantages, but before I implement this I would like to hear what you > think. > > Thanks in advance. > > Preben > -- > Ada95 makes your code less cryptic. >