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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fee8802cc3d8334d X-Google-Attributes: gid103376,public X-Google-Thread: 10a146,fee8802cc3d8334d X-Google-Attributes: gid10a146,public From: mike@ooo.nospam.com Subject: Re: Ada and Java. different behaviour. casting long to int problem. Date: 1999/06/18 Message-ID: <7ke2dg$2a7a@drn.newsguy.com>#1/1 X-Deja-AN: 491180031 References: <7jt2c0$vrb@drn.newsguy.com> <7k57vb$1ipf@drn.newsguy.com> <3766650F.705125B7@pwfl.com> <7k64t7$igo$1@its.hooked.net> <7k689a$ci2@drn.newsguy.com> <3766C842.E1EAB60A@pwfl.com> <3766D1CC.D712895E@itools.symantec.com> <7k8nn5$qcb$1@its.hooked.net> <3767E8A2.EF1A0570@itools.symantec.com> <7k8tv3$3gm@drn.newsguy.com> <3769506F.157411C0@mitre.org> <7kbujm$1kb@drn.newsguy.com> Organization: None Newsgroups: comp.lang.ada,comp.lang.java.programmer Date: 1999-06-18T00:00:00+00:00 List-Id: In article , Hyman says... > > >But no one generally expects arithmetic overflow exceptions, so no one >writes exception handlers for them. You do not need to put special handler for this, use a general, catch all handler. Then if interested, check for the specific handler your care about handling. The way I look at things is that, each function/procedure/method is responsible for catching any expception it can generate. Then it either handle them locally, or if it can not, throw them to the caller. At worst, a programmer can simply start their method with a try, and end it with a catch. But all of this is a programming and design issue. just becuase programmers forget to do the right thing, does not mean a language should not provide a good feature, that if the a programmer forgot to use, can lead to different type of failure. Notice that your solution of letting the bad data exist without raising an excpetion, will also lead to a failure, but you claim that your failure is less bad than the failure that can result from exception raising. I diagree with that also as was said before. Now, lets examine your statment again and show how illogical it is from a different point of view. How is your statment different from: 'But no one generally expects boundary array overrun exceptions, so no one writes exception handlers for them'. Array boundary overruns are the same thing. In Java or Ada, how many programmers put special exception handlers for those? almost no one. Yet, the language run-time does generate an exception when this happens. Are you then saying the language should NOT throw an exception when someone walks over the array boundaries travelling to lala land as they wish? >As a result, when an overflow exception happens, there is no local >handler to process it. So, teach people to use exception handlers correctly! (and to do more tesing). Bad programmers and bad design and lack of testing is NO execuse for not using exception handlers! Mike.