From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.7 required=3.0 tests=BAYES_00,NICE_REPLY_A, REPLYTO_WITHOUT_TO_CC,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Extra information in the message string of exceptions. Date: Sat, 29 Oct 2022 10:59:53 +0200 Organization: A noiseless patient Spider Message-ID: References: <3bc7a99c-d541-497b-b3fd-7a6db0ee0de9n@googlegroups.com> <574017e3-d354-41b9-87a1-1f3aa6edf4a2n@googlegroups.com> <371ba8ca-2304-4e8a-a77f-82548d706105n@googlegroups.com> Reply-To: nonlegitur@notmyhomepage.de MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 29 Oct 2022 08:59:53 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="ec8d82d1a065ee0465ed087dc618aed0"; logging-data="3599256"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18v+w/bBeSkdOIr5nCvSDvJ6OMnD+H9kjQ=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Cancel-Lock: sha1:AxsW6Yni2ie6HiRe78QxfmnijsY= Content-Language: en-US In-Reply-To: Xref: reader01.eternal-september.org comp.lang.ada:64567 List-Id: On 29.10.22 05:10, Rod Kay wrote: >    I'm a little surprised that the compiler shows a warning rather than an error but I suppose there must be some reason for that. Formal language reasons aside, a program's author may have wanted the program to raise an exception. (For example: "There is a TODO here, so make sure the program never runs past this point. Assign out of range.") GNAT just emits a warning for the following program, albeit not the same warning. BTW, what would SPARK do here? procedure Excpt is Works_As_Expected: exception; procedure Test is begin if 1 = 1 then raise Works_As_Expected; else raise Program_Error; end if; end Test; begin Test; end Excpt;