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!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!208.49.83.154.MISMATCH!uns-out.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Structured exception information References: From: Stephen Leake Date: Tue, 23 Jan 2007 02:33:56 -0500 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:YjelpFVL7U2P80Ay4fACMKc8PIs= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 5ad1945b5ba6a759e00d411292 Xref: g2news2.google.com comp.lang.ada:8411 Date: 2007-01-23T02:33:56-05:00 List-Id: Robert A Duff writes: >>... 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. > > I don't think that's the issue. If you raise an exception with a String > attached (whether that's S_E or not), and there's no stack space to > allocate that String, then the run-time system needs to be prepared to > raise a "plain old" Storage_Error. That's just a special case: if ANY > operation runs out of stack, the run-time system needs to be able to > raise S_E. That's no big deal -- just reserve enough extra space on > every task's stack, so that raising S_E is always possible. And that > "extra stack space" is a fixed small number of bytes. So you are saying: raise My_Exception with ; is allowed to become (in effect); raise Storage_Error; I guess that makes sense, and is true now. I hadn't quite realized that. > I think the 200-char limit was based on concerns about managing the > memory. (Misguided concerns, IMHO.) The exception occurrence is > allocated on the stack at the point of the raise, and it somehow needs > to appear at the point of the handler. That's tricky, but doable (after > all, Ada allows "return String", which is pretty much the same idea). > Heap allocation may be necessary in some cases (as Stroustrup points out > in one of his books on C++). That's OK -- embedded systems might want > to avoid those cases. Yes, I agree, in the absense of Storage_Error, dynamic exceptions should be no harder than dynamic function results. -- -- Stephe