From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Exiting from a function or procedure
Date: 2000/04/21
Date: 2000-04-21T00:00:00+00:00 [thread overview]
Message-ID: <wccn1mndn4q.fsf@world.std.com> (raw)
In-Reply-To: sg0q4tb0l6e48@corp.supernews.com
"Andres Tarallo" <atarallo@chasque.apc.org.NOSPAM> writes:
> function "+"(izq, der: in term) return term is
> aux: term;
> error_suma: exception;
> begin
> if (izq.exponente = der.exponente) then
> aux.coeficiente:= (izq.coeficiente + der.coeficiente);
> aux.exponente:= izq.exponente;
> return aux;
> else
> raise error_suma;
> end if;
> exception
> when error_suma => Put(" ERROR !!!");
> end;
Just raise the exception, and don't handle it. That is, get rid of
"exception when ... ;". Then the program will stop on that error.
> When I compile this it compiles fine, however i get a warning
> telling me that this could raise an exception during runtime.
That's probably a different problem. I can't tell from the excerpt you
gave.
> I'm still not very familiar with exceptions and it's handling,
> Am I doing things in the right way? After displaying the message may program
> will terminate?
No. After you handle an exception, the program continues on, unless you
re-raise the exception.
If you want the exception to kill the program, then just raise it.
Don't handle it.
- Bob
next prev parent reply other threads:[~2000-04-21 0:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-21 0:00 Exiting from a function or procedure Andres Tarallo
2000-04-21 0:00 ` Robert A Duff [this message]
2000-04-21 0:00 ` tmoran
2000-04-21 0:00 ` Andres Tarallo
2000-04-22 0:00 ` Robert Dewar
2000-04-22 0:00 ` tmoran
2000-04-22 0:00 ` Ray Blaak
2000-04-22 0:00 ` David Starner
2000-04-23 0:00 ` Robert Dewar
2000-04-23 0:00 ` tmoran
2000-04-24 0:00 ` Robert Dewar
2000-04-24 0:00 ` tmoran
2000-04-24 0:00 ` Robert Dewar
2000-04-24 0:00 ` Robert Dewar
2000-04-22 0:00 ` Ken Garlington
2000-04-22 0:00 ` Pablo Moisset
2000-04-23 0:00 ` Robert Dewar
2000-04-24 0:00 ` Scott Ingram
2000-04-22 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox