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=-0.5 required=5.0 tests=BAYES_00,INVALID_MSGID, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,dabd2d2ffbcf1daa X-Google-Attributes: gid103376,public From: "Andres Tarallo" Subject: Re: Exiting from a function or procedure Date: 2000/04/21 Message-ID: #1/1 X-Deja-AN: 614201045 References: Organization: Posted via Supernews, http://www.supernews.com X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: comp.lang.ada X-Complaints-To: newsabuse@supernews.com Date: 2000-04-21T00:00:00+00:00 List-Id: tmoran@bix.com escribi� en mensaje ... >>this program i have a procedure that must do something if it's parameters >>meet a certain condition; otherwhise it must exit. > Do you mean the procedure must exit in the sense of return, or exit >in the sense of stopping the program? Your C examples suggests the >latter. Thats the idea !!! when something goes wrong display a message and stop. > You could use "pragma import" on the C "exit" procedure and just >call it, exactly as your C program does. Your code using an exception >is fine except that it catches the exception, prints the error message, >and then tries to drop out the bottom of the function without returning >any value. You probably want to add a "raise;" statement after >the Put, to re-raise the exception. Ok, thanks for the advice, remember that this are my first programas in ADA and still i'm not very familiar with the languaje. > Note also that some compilers are only half-smart and will give a >warning on the construct >[..] >because the compiler realizes that if the program takes the "else" >branch it will drop out the bottom of the function without returning >any value, but the compiler doesn't realize that some_exception will >be raised and prevent reaching the bottom of the function. It does give me a warning, but some thing do happen to some C/C++ compilers so i didn't bothered in that message Thanks Andres Tarallo