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-06-01 09:08:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail Message-ID: <3EDA24D2.6060003@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: I/O - exception handling References: <3ED4114A.5060204@spam.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1054483691 24.62.164.137 (Sun, 01 Jun 2003 16:08:11 GMT) NNTP-Posting-Date: Sun, 01 Jun 2003 16:08:11 GMT Organization: AT&T Broadband Date: Sun, 01 Jun 2003 16:08:11 GMT Xref: archiver1.google.com comp.lang.ada:38286 Date: 2003-06-01T16:08:11+00:00 List-Id: Randy Brukardt wrote: > It wouldn't be *expected*, but the standard *allows* it, so the truly > paranoid programmer would have to take that into account. And even if > you defined it not to raise any IO_Exceptions, it still could raise > Storage_Error or Program_Error, so you can't claim that it never, ever > raised any exceptions anyway. > > As I said, its not worth worrying about; in practice, it won't raise an > exception, and there is no need to protect it. But you can't determine > that from the standard (and there is no possible standard language from > which you could). At the risk of being repitious there are cases in Ada where unusual behavior can be associated with particular file types. A good example I ran into years ago was an OS where opening a pipe required a special call that returned two file descriptors, and only the first (the write end) could be closed, which closed the whole pipe. An excellent example of where a call to Close should raise Use_Error. But notice that opening the pipe took a non-standard Open call. Another example as I said was that on systems where closing Standard_XXX is not allowed, Close should raise Use_Error--if you can somehow get ahold of a copy of the (Ada) file object for those files. Notice that Close takes an in out File_Type, so the Standard_XXX or Current_XXX calls cannot be used as a parameter. (A user could use the forms which return File_Access, and play some games to convert from File_Access which is access constant File_Type, then call Close on the result--and get what he or she deserves. ;-) The Ada culture is to ignore these cases--unless you are the user in question. Then you had better look for all sorts of "unexpected" exceptions resulting from your use of Unchecked_Conversion or whatever.