From: cupak@rapnet.sanders.lockheed.com (John J Cupak Jr CCP)
Subject: Main (function) program with exit(status)
Date: 16 Sep 1994 15:05:30 GMT
Date: 1994-09-16T15:05:30+00:00 [thread overview]
Message-ID: <35cc7q$9it@rapnet.sanders.lockheed.com> (raw)
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
next reply other threads:[~1994-09-16 15:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-09-16 15:05 John J Cupak Jr CCP [this message]
1994-09-16 21:39 ` Main (function) program with exit(status) David Emery
1994-09-16 22:31 ` Bob Kitzberger
1994-09-17 3:18 ` Robert Dewar
1994-09-17 16:31 ` Mats Weber
1994-09-23 14:35 ` Main (function) program with exit(stat Bob Gilbert
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox