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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,98c463a9e98cfdf5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-13 10:12:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0900.news.uu.net!reader0902.news.uu.net!not-for-mail Message-ID: <3D08D2AA.1020502@mail.com> Date: Thu, 13 Jun 2002 13:13:14 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada exceptions. unchecked? References: <8db3d6c8.0206112300.3965a62b@posting.google.com> <3D0750F1.7A12342@raytheon.com> <$4ctS45vG2pB@eisner.encompasserve.org> <3D0771D3.FFEA1AA4@san.rr.com> <3D08ADF9.7040104@mail.com> <3D08CB6F.D68F18DE@san.rr.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Cache-Post-Path: master.nyc.kbcfp.com!unknown@mosquito.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1023988357 reader2.ash.ops.us.uu.net 7481 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:25891 Date: 2002-06-13T13:13:14-04:00 List-Id: Darren New wrote: > I suspect the point in Java was to *force* you to deal with it. > How many C programmers write something like > > buffer = malloc(size); > fill_in_buffer(buffer, size); > write(handle, buffer, size); > > without checking that malloc succeeded or that the write actually wrote the > right number of characters? If malloc() and write() threw exceptions that > you were *required* to catch or declare, you couldn't get away with this. > The real problem is callbacks and exceptions, not just the declared > exeptions. The point is to force the program to deal with problems. So in your example, malloc will throw an exception if it fails to allocate memory, and write could throw if it is given a null pointer. That's fine. And at some point in the program we could have an exception handler that deals with this. But why does every intervening function in the call tree have to state for the record that it knows that something it calls may throw such an exception, if it is not the place where the exception is handled?