comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Main (function) program with exit(status)
Date: 16 Sep 1994 23:18:56 -0400
Date: 1994-09-16T23:18:56-04:00	[thread overview]
Message-ID: <35dn70$3vf@gnat.cs.nyu.edu> (raw)
In-Reply-To: 35cc7q$9it@rapnet.sanders.lockheed.com

"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!"

The LRM says nothing of the kind. It says "A subprogram that is a library
unit can be used as a main program ...".

It then goes on to say that an implementation *may* but certainly not
*must* limit main programs, but must in any case allow parameterless
procedures.

Given this, when writing portable code, stick to parameterless procedures.

But there is nothing to stop an implementor allowing functions to return
a status (or whatever), or even to accept arguments (argc, argv???)

GNAT allows either parameterless procedures, or functions returning any
integer type, and interpretes the integer as a return code, as in this
example.

Still, don't use this in portable code!




  parent reply	other threads:[~1994-09-17  3:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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