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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ee1a8b8db84c88f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g43g2000cwa.googlegroups.com!not-for-mail From: "Hyman Rosen" Newsgroups: comp.lang.ada Subject: Re: Ada exception block does NOT work? Date: 18 Aug 2005 15:01:01 -0700 Organization: http://groups.google.com Message-ID: <1124399997.240058.126690@g43g2000cwa.googlegroups.com> References: <4301ab29$0$6989$9b4e6d93@newsread2.arcor-online.net> NNTP-Posting-Host: 204.253.248.208 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1124402466 10478 127.0.0.1 (18 Aug 2005 22:01:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 18 Aug 2005 22:01:06 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: g43g2000cwa.googlegroups.com; posting-host=204.253.248.208; posting-account=lJDDWg0AAACmMd7wLM4osx8JUCDw_C_j Xref: g2news1.google.com comp.lang.ada:4177 Date: 2005-08-18T15:01:01-07:00 List-Id: Robert A Duff wrote: > But it does mean that exceptions are not well-integrated, > since certain run-time errors that really ought to cause > exceptions do not. For example, overflow on signed integer > arithmetic. This argument is flawed. It would make sense only if C++ detected signed overflow and reported the error other than by raising an exception. C++ merely follows the lead of its parent language and does no checking for this condition. It's not because exceptions were unavailable, it's because requiring the check was conceived to be potentially too costly and would have served as a barrier to adoption because it would have slowed down the equivalent code in C++ with respect to C. Actually, since signed overflow is undefined behavior, an implementation is free to check for it and raise an exception if it wants to. The checked vector accessor reports a bad index through exceptions. The memory allocator reports failure through exceptions. The formatted I/O system can report failure through exceptions (although it's normally more convenient to check for errors at the end).