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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!p6g2000pre.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: How to exit an Ada program with (unix shell) error code? Date: Tue, 5 May 2009 14:01:27 -0700 (PDT) Organization: http://groups.google.com Message-ID: <11acf6a5-d0cb-4c22-b3e0-1ff833348923@p6g2000pre.googlegroups.com> References: <49ba30c9-a1e6-4346-8618-d256f87ac301@s31g2000vbp.googlegroups.com> <62b174a9-c9c5-479c-9dd6-71916c102eb0@z16g2000prd.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1241557287 22504 127.0.0.1 (5 May 2009 21:01:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 5 May 2009 21:01:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p6g2000pre.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5696 Date: 2009-05-05T14:01:27-07:00 List-Id: On May 5, 1:48 pm, a...@anon.org (anon) wrote: > Actually, Adam the design for all OS currectly use today states that if the > program returns the "Accumulator Register" will contain the program exit > code. Been a standard for at least 40 years. Define "the program". "The program" that is run by the OS is not necessarily the Ada main subprogram. In fact, it probably won't be. An Ada subprogram used as the main program isn't going to have all the library package elaboration or finalization code run by the Ada environment task (RM 10.2), since it is compiled separately, and at the time it's compiled the Ada compiler won't necessarily know that it's going to be the main program. Therefore, the "program" is probably going to be some sort of wrapper that calls the initialization code, calls the main subprogram, then calls the finalization code. There's no standard anywhere that says that this wrapper must preserve the value that the Ada main subprogram sticks in the accumulator register (or wherever function results are stored). [P.S. Note that the environment task is a *task* and has no return value, in Ada semantics, for what it's worth.] So your comment isn't particularly relevant. It certainly doesn't prove anything. -- Adam