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-Thread: 103376,699cc914522aa7c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!uns-out.usenetserver.com!news.usenetserver.com!pc03.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Structured exception information References: From: Stephen Leake Date: Sun, 21 Jan 2007 17:42:44 -0500 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:YHszkQUnuK6IMPsykR6pCohoXXo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 8695b45b3ec6a759e00d431278 Xref: g2news2.google.com comp.lang.ada:8385 Date: 2007-01-21T17:42:44-05:00 List-Id: Robert A Duff writes: > Stephen Leake writes: > >> 1) Define structured exceptions in Ada. We _know_ that _all_ compilers >> will not meet the standard in some way, and each in different ways. > > I'm confused by that statement. Are you merely saying that "compilers > have bugs"? It's (sadly) true, but that's not a valid criticism of this > particular feature. Or are you saying there's something specific about > the "exceptions as objects" feature we're discussing that makes it hard > (impossible?!) to implement, and therefore buggy? The latter. But apparently I'm wrong, given the current state of the art. > It's certainly more difficult to implement data attached to > exceptions, compared to the Ada 83 feature, where an exception can be > represented as a fixed-size (one word) compile- or link-time-known > quantity. Managing variable sized things is definitely harder. > But I fail to see how exceptions with Strings attached (he he) > is easier to implement than exceptions with arbitrary (typed) data > attached. This is related to an issue that you raised earlier; in Ada 2005 there is a limit of 200 characters on the string. I believe that is because exceptions with Strings must work even when the exception is Storage_Error due to either heap exhaustion or stack overflow. You can't allocate space for the attached data at the point of the exception; you have to allocate a 200 byte buffer somewhere (in per-task space?) ahead of time, in case an exception is raised. (a side note: 200 is arbitary; we need a pragma Exception_Data_Size, which would default to 200.) It's much better to trucate a String to 200 bytes than some user-defined type. I supposed fixed-size user-defined types that are smaller than 200 bytes could work. But I don't see how to allow dynamically sized data. -- -- Stephe