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,d8a4797a79f9c90f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-26 19:20:41 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!tdsnet-transit!newspeer.tds.net!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: I/O - exception handling Date: 26 May 2003 21:20:39 -0500 Organization: LJK Software Message-ID: References: NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1054002012 17864 192.135.80.34 (27 May 2003 02:20:12 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Tue, 27 May 2003 02:20:12 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:37819 Date: 2003-05-26T21:20:39-05:00 List-Id: In article , Hyman Rosen writes: > Sergey Koshcheyev wrote: >> Now of course, the fact that Close raises exceptions seems sort of useless, >> even unhelpful. What am I supposed to do with a file, if I can't close it? > > We encounter this in C++ as well. The only thing you can do when close > fails is to notify the user. C++ fstream objects have a close method > which returns an error code if the underlying close fails, and their > destructors just do a close without checking for errors, so you can > have it whichever way you want. I saw a case where a major defect in some software (not Ada or C*) that would have been detected in a much less disruptive fashion if only a failure on closing a file had not been ignored. The person who programmed it to be ignored thought "the file failing to close will be immaterial shortly after this anyway" whereas in fact the failure to close ended up indicating (or not, in this case) some significant error in overall program logic.