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 X-Google-Thread: 103376,57ca86d2263c2ca9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-30 12:10:18 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news-xfer.cox.net!newshub.sdsu.edu!newshub1.wanet.net!uunet!sac.uu.net!dfw.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: Gnat: system__finalization_implementation__finalize_list User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Thu, 30 Jan 2003 20:09:31 GMT Content-Type: text/plain; charset=us-ascii References: <3e379038$0$350$bed64819@news.gradwell.net> <3e38bbbc$0$346$bed64819@news.gradwell.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:33615 Date: 2003-01-30T20:09:31+00:00 List-Id: Stephen Leake writes: > porton@ex-code.com (Victor Porton) writes: > > > (1) I compiled my program whose effectively main rountine is not a > > procedure but a begin...end block of a package specifically designed to > > be used as the main rountine. It is perfectly legal accordingly ARM > > I could not find the reference that supports this; can you quote it? Mr. Porton is correct: the main subprogram is optional in Ada 95. This means that every Ada implementation must support programs (partitions, actually) that have no main subprogram. In Ada 83, a main subprogam was required (but it was confusingly called the "main program"). Since most Ada compilers require the main subprogram to be a procedure, not a function, I usually call the "main procedure". "Main routine" is not Ada jargon -- I suppose Mr. Porton can reasonably use it to refer to a package body, if he likes. The reasons for making main subprograms optional in Ada 95 were: There are some programs that do all their work in library level tasks; it seems silly to make them write a main subprogram with a "null;" statement. Annex E defines the notion of "shared passive partitions", for which it was thought that main subprograms make no sense. If you're trying to link some Ada code with some other language, where the other language gets control first, then it makes no sense to have a main subprogram on the Ada side. > I don't see how it can arrange to call 'adainit' and 'adafinal' in > this case. That is probably your problem. Adainit is called *before* the main subprogram (if any), and adafinal *after*. If there's no main subprogram, that has no effect on when adainit and adafinal get called. If it's an all-Ada program, they get called automatically; if it's a C program with some Ada inside, then the C code had better call adainit and adafinal "by hand". > Try it with a normal 'main procedure', just for kicks. Shouldn't matter. - Bob