comp.lang.ada
 help / color / mirror / Atom feed
From: lutz@iks-jena.de (Lutz Donnerhacke)
Subject: Re: Array of exception
Date: Thu, 4 Oct 2001 08:53:10 +0000 (UTC)
Date: 2001-10-04T08:53:10+00:00	[thread overview]
Message-ID: <slrn9ro8rl.4a.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: Pmpu7.2877$403.1630126@news1.rdc1.sfba.home.com

* tmoran@acm.org wrote:
>>     when -1 => raise EXXX;
>>     when -2 => raise EYYY;
>>     ...
>>Using Exception_Id and Raise_Expression require me to rewrite the whole CASE
>>into an explicit array so I do not shorten the source code anyway.
>
>Clarify please.  It appears that somewhere you need to establish the
>relation between, eg, -2 and EYYY.

Trivial: I'd tried
  type extract_inband_exception_t is array(Positive) of exception;
  extract_inband_exception : constant extract_inband_exception_t := (
     EXXX, EYYY, ... );
in order to instanciate the list of exceptions and there order at once.

>Is
>   case res is
>      when -1 => raise EXXX;
>      when -2 => raise EYYY;
>      ...
>preferable to
>   jump : constant array(...) of Exception_ID :=
>     (-1 => EXXX'Identity,
>      -2 => EYYY'Identity,
>      ...

Yep. The case generates faster code for the normal return value case. ;-)




      parent reply	other threads:[~2001-10-04  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-02  8:50 Array of exception Lutz Donnerhacke
2001-10-02 11:02 ` maa
2001-10-02 10:13   ` Lutz Donnerhacke
2001-10-02 20:23     ` tmoran
2001-10-03 16:25       ` Darren New
2001-10-04  8:53       ` Lutz Donnerhacke [this message]
replies disabled

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