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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,144064e39ca0ca6a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-17 20:52:21 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Main (function) program with exit(status) Date: 16 Sep 1994 23:18:56 -0400 Organization: Courant Institute of Mathematical Sciences Message-ID: <35dn70$3vf@gnat.cs.nyu.edu> References: <35cc7q$9it@rapnet.sanders.lockheed.com> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1994-09-16T23:18:56-04:00 List-Id: "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!