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 11:08:41 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!uninett.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: I/O - exception handling Date: Mon, 26 May 2003 18:08:41 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: NNTP-Posting-Host: kiuk0152.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1053972521 1079 129.241.83.78 (26 May 2003 18:08:41 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Mon, 26 May 2003 18:08:41 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:37807 Date: 2003-05-26T18:08:41+00:00 List-Id: Sergey Koshcheyev wrote: >> Safe_Close (File); > > I'd change the line above to just "Close (File);", to have the opportunity > to handle any error raised by Close. Sure, I thought you didn't want though. >> Now you can use the Safe_Close in any function you like. > > I thought of this solution, but here the problem is code duplication. In > this case it doesn't matter, but what if there were several files? You'd > have a procedure Close_All and a procedure Safe_Close_All, which would both > contain similar code. Please explain, I don't follow you. > But I guess the perfect general solution doesn't exist in Ada. By the way, > it seems to exist in C++, which is sort of strange, shouldn't it be the > other way around? ;-) Your solution seems close enough to perfect, however, > so that's probably what I'd use. Well why don't you use Finalize ? -- Preben Randhol http://www.pvv.org/~randhol/