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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Bob Duff Newsgroups: comp.lang.ada Subject: Re: Arm - ravenscar - exceptions - last chance handler Date: Sat, 30 May 2015 11:31:37 -0400 Organization: A noiseless patient Spider Message-ID: <87d21im692.fsf@theworld.com> References: <41913ae0-7513-4be5-bb94-b834836f8525@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="14c3aa0ed609729d87331eded2d3b15e"; logging-data="24788"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ZaGesYrWK87uXeY50UTz0" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:4rQCDUlx4onQOTQZsarUspg38Mo= sha1:XcWiZ54QAg7Ms5GgqlI7rHNl8gk= Xref: news.eternal-september.org comp.lang.ada:26100 Date: 2015-05-30T11:31:37-04:00 List-Id: jan.de.kruyf@gmail.com writes: > How is last chance handler going to know the --length-- of the message? It's a NUL-terminated string, as the comment in the spec says: procedure Raise_Exception (E : Exception_Id; Message : String := ""); pragma No_Return (Raise_Exception); -- Unconditionally call __gnat_last_chance_handler. Message should be a -- null terminated string. Note that the exception is still raised even -- if E is the null exception id. This is a deliberate simplification for -- this profile (the use of Raise_Exception with a null id is very rare in -- any case, and this way we avoid introducing Raise_Exception_Always and -- we also avoid the if test in Raise_Exception). > If we say that I have to append an ASCII.NUL when I raise an exception > then it runs havoc with the other runtime modules where exceptions are > used. Why? To raise an exception, you just say "raise Some_Exception;". No need to fool about with ASCII.NUL, except in the last-chance handler itself; the default version says: exit when Msg_Str (J) = Character'Val (0); - Bob