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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dabd2d2ffbcf1daa X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Exiting from a function or procedure Date: 2000/04/21 Message-ID: #1/1 X-Deja-AN: 614143034 Sender: bobduff@world.std.com (Robert A Duff) References: Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-04-21T00:00:00+00:00 List-Id: "Andres Tarallo" 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