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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a3ca574fc2007430 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Ada and Automotive Industry Date: 1996/12/17 Message-ID: #1/1 X-Deja-AN: 204554478 references: organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1996-12-17T00:00:00+00:00 List-Id: In article <32B197A6.2781E494@escmail.orl.lmco.com> Ted Dennison writes: > Hmmm. Can I take this to mean that it is not a good idea to raise > predefined exceptions manually? Are predefined exceptions somehow > handled differently than user-defined ones? I'll answer this in reverse order. The Ada 95 11.6 allows the optimization of language defined checks, not explicit raise statements. However, you can have situations where the failure of a languagge defined check will cause an explicit raise statement to be invoked: begin Foo := new Bar(A*B); --allocate A*B bytes. exception when others => raise Storage_Error; -- if A*B overflows, raise Storage_Error anyway. end; If Foo is never used, it is legal to optimize away the allocation, whether the handler raises Storage_Error or Fubar. For this reason I prefer to explicitly raise a predefined exception when the raise can get optimized away like this. So my rule on explicitly raising predefined exceptions is that I will raise them either if the meaning is the predefined meaning of that exception, or if suppression of a language defined check, either explicitly or through 11.6, will potentially suppress the exception. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...