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,d8a4797a79f9c90f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-27 12:40:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!panix!yellow.newsread.com!netaxs.com!newsread.com!feed2.newsreader.com!newsreader.com!newshosting.com!news-xfer2.atl.newshosting.com!uunet!dca.uu.net!ash.uu.net!spool0902.news.uu.net!not-for-mail Date: Tue, 27 May 2003 15:40:22 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030506 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: I/O - exception handling References: <3ED38FA6.5050002@cogeco.ca> In-Reply-To: <3ED38FA6.5050002@cogeco.ca> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1054064423.70494@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1054064423 244 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:37859 Date: 2003-05-27T15:40:22-04:00 List-Id: Warren W. Gay VE3WWG wrote: > If the underlying fclose() fails this could represent > a variety of serious program flaws and/or media defects: It could represent Martians shooting rayguns at your disk, too. My point is that there's absolutely nothing you can do about it except perhaps trying to recreate the entire file. > I think raising exceptions in close makes sense The problem is that if you're doing close in finalization, allowing an exception to escape leads to program termination in C++ and raising Program_Error in Ada. That's why you have dual-mode closing, with an explicit close request that you can check for error, and an automatic close in finalization where you ignore the error.