From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Help understanding the benefits of Ada's exception model
Date: Thu, 26 Jun 2014 09:08:01 -0700
Date: 2014-06-26T09:08:01-07:00 [thread overview]
Message-ID: <lohgh1$1k3$1@dont-email.me> (raw)
In-Reply-To: <a7861962-ff0c-4c30-a916-b5c6e2afae01@googlegroups.com>
On 06/26/2014 07:28 AM, Patrick wrote:
> Sorry for answering my own post. I think I have not used the terms unchecked
> exception and check exceptions properly. Better terms would be handling
> exceptions and handling error codes.
The pitfalls of relying on error codes are well documented, the most obvious
being the numerous cases where they're not checked. An exception cannot be ignored.
What is ideal is code that offers a check to avoid causing the exception, while
raising the exception if the check is not used:
if not Stack.Is_Empty then
Stack.Pop (Item => V);
-- Use V
end if;
but
Stack.Pop (Item => V); -- raises Empty if Stack.Is_Empty
--
Jeff Carter
"Many times we're given rhymes that are quite unsingable."
Monty Python and the Holy Grail
57
prev parent reply other threads:[~2014-06-26 16:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 11:42 Help understanding the benefits of Ada's exception model Patrick
2014-06-26 14:28 ` Patrick
2014-06-26 15:22 ` Dan'l Miller
2014-06-26 15:25 ` G.B.
2014-06-26 15:52 ` Patrick
2014-06-26 16:55 ` Niklas Holsti
2014-06-26 23:27 ` Georg Bauhaus
2014-06-26 16:08 ` Jeffrey Carter [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