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.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,144064e39ca0ca6a,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-17 11:11:28 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!yeshua.marcam.com!charnel.ecst.csuchico.edu!olivea!sgigate.sgi.com!sgiblab!pacbell.com!uop!csus.edu!netcom.com!netcomsv!butch!rapnet.sanders.lockheed.com!rapnet!cupak From: cupak@rapnet.sanders.lockheed.com (John J Cupak Jr CCP) Newsgroups: comp.lang.ada Subject: Main (function) program with exit(status) Date: 16 Sep 1994 15:05:30 GMT Organization: Lockheed Sanders, Inc. Sender: cupak@rapnet (John J Cupak Jr CCP) Distribution: world Message-ID: <35cc7q$9it@rapnet.sanders.lockheed.com> Reply-To: cupak@rapnet.sanders.lockheed.com (John J Cupak Jr CCP) NNTP-Posting-Host: rapnet.sanders.lockheed.com Date: 1994-09-16T15:05:30+00:00 List-Id: In a recent code review, I saw the following code for an Ada main program (LOTS of real code omitted!): function Example return Integer is begin return (-1); end Example; It was the intent of the developer to return a non-zero status to the unix shell in the event of an internal error. (btw, it works!) Most coding standards, and even the LRM, state that the main program must be a parameterless procedure. However, it seems that there's nothing to prevent the main program from being a parameterless function! I suggested that the programmer insert a call to the unix exit() function (with appropriate interface pragmas) instead. I wrote a short test program under VAX/VMS Ada, and discovered that DCL will trap/check the return status of an Ada main program also. However, the status must have values according to the VMS Status Word. Has anyone encountered/used this technique before? What do you 'netters think on this one? John J. Cupak, Jr., CCP Lockheed DECNet: NHQVAX::CUPAK Lockheed Sanders, Inc. Internet : cupak@rapnet.sanders.LOCKHEED.COM 95 Canal Street / MER15-2403 CompuServe : 72411.3176@compuserve.com Nashua, NH 03061-0868 Telephone : (603) 885-2142 FAX: 885-1480