comp.lang.ada
 help / color / mirror / Atom feed
* Main (function) program with exit(status)
@ 1994-09-16 15:05 John J Cupak Jr CCP
  1994-09-16 21:39 ` David Emery
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: John J Cupak Jr CCP @ 1994-09-16 15:05 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1994-09-23 14:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-09-16 15:05 Main (function) program with exit(status) John J Cupak Jr CCP
1994-09-16 21:39 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox