comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: writing on terminal before an exception
Date: Mon, 3 Aug 2009 17:14:16 -0700 (PDT)
Date: 2009-08-03T17:14:16-07:00	[thread overview]
Message-ID: <a433899c-85a2-4564-9310-b1ac629f6338@d4g2000prc.googlegroups.com> (raw)
In-Reply-To: 6cfd7d42-3184-47d8-b11c-0a2a2a412058@v20g2000yqm.googlegroups.com

On Aug 3, 3:29 pm, Yannick Duchêne Hibou57 <yannick_duch...@yahoo.fr>
wrote:
> On 3 août, 22:40, vlc <just.another.spam.acco...@googlemail.com>
> wrote:
>
> > Have you already considered something like
>
> > raise Sh3_NoData with "No SH3 data.";
>
> > I'm not absolutely sure, but I think this will only compile in Ada
> > 2005.
>
> It will, surely, as said the ARM 2005 :
>
> ARM 11.3 (2/2) says
>
> > raise_statement ::= raise;
> >       | raise exception_name [with string_expression]; raise [exception_name];
>
> But he will loose the default exception informations which are useful
> too (the string provided will replace the exception message which is
> defaulted to some exception informations).

It isn't lost.  If the exception is caught,
Ada.Exceptions.Exception_Information will still return information.
The RM says that Exception_Information returns "implementation-defined
information about the exception occurrence", and that
Exception_Message returns "implementation-defined information about
the exception occurrence" if RAISE is used without a
string_expression.  The RM doesn't say what the relationship between
those two strings is, but it's reasonable to assume that the string
returned by Exception_Information is at least as informative as the
default one returned by Exception_Message, if the two strings aren't
identical.

None of this matters if the exception isn't caught.  If the exception
is propagated out of the main program, the behavior is implementation-
dependent, and there's no guarantee that the message or any other
information will be displayed.  If the exception is propagated out of
a task body, the task will terminate and any message in the
RAISE...WITH statement will be lost.

                                           -- Adam




  reply	other threads:[~2009-08-04  0:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-02 17:47 writing on terminal before an exception Mark Fabbri
2009-08-03  1:13 ` Yannick Duchêne Hibou57
2009-08-03  6:39 ` Stephen Leake
2009-08-03 20:40 ` vlc
2009-08-03 22:29   ` Yannick Duchêne Hibou57
2009-08-04  0:14     ` Adam Beneschan [this message]
2009-08-04  1:07       ` stefan-lucks
2009-08-04 20:18 ` Mark Fabbri
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox