comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: How to exit an Ada program with (unix shell) error code?
Date: Thu, 14 May 2009 02:34:31 -0700 (PDT)
Date: 2009-05-14T02:34:31-07:00	[thread overview]
Message-ID: <95635a77-2c90-4993-be38-61788ef461d1@s16g2000vbp.googlegroups.com> (raw)
In-Reply-To: 3896e2a7-da0f-4a90-82cf-a776f654a880@b1g2000vbc.googlegroups.com

Martin wrote on comp.lang.ada:
> On May 14, 3:55 am, a...@anon.org (anon) wrote:
> [snip]
>
> > Also for Martin.
>
> > Can a user-created procedure (main subprogram) be concerned as a "public
> > parameterless library procedures.  No! The reason is that the procedure
> > is not public, it first must be bound by the binding process.
>
> > 10.2  (29) An implementation may restrict the kinds of subprograms it
> >            supports as main subprograms. However, an implementation is
> >            required to support all main subprograms that are public
> >            parameterless library procedures.
>
> Ohhh groan.....I think I see what you're trying to say but you've got
> the wrong end of the stick.
>
> It's saying that you can't have this as a main procedure:
>
> package Application is
> private
>    procedure Main;   -- NB: in private part of package-decl
> end Application;
>
>    or
>
> package Application is
>    ...
> end Application;
>
> package body Application is
>    ...
>    procedure Main;    -- NB: Declaration in body not spec
>    ...
>    procedure Main is
>    ...
>    end Main;
>    ...
> end Application;
>
> It's not taking about binding (as nothing in the RM talks about
> binding).

The following is not a "public library procedure" either since it is
not declared at library level:

package Application is -- package at library level
   procedure Main; -- subprogram not at library level
end Applicatin;

There is another non-portable, compiler-dependent possibility which is
to not have a main subprogram at all but instead to rely on
elaboration:

package Application is
   pragma Elaborate_Body;
end Application;

package body Application is
begin
   ...
end Application;

Again the RM does not require the compiler to support this, so this is
non-portable.

--
Ludovic Brenta.



  parent reply	other threads:[~2009-05-14  9:34 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04  9:08 How to exit an Ada program with (unix shell) error code? reinkor
2009-05-04  9:17 ` Samuel Tardieu
2009-05-04  9:26   ` reinkor
2009-05-04  9:31     ` Ludovic Brenta
2009-05-04  9:47       ` reinkor
2009-05-04  9:54         ` Martin
2009-05-04 11:38           ` sjw
2009-05-04 10:07       ` stefan-lucks
2009-05-04 13:42     ` Robert A Duff
2009-05-04 16:19       ` Martin
2009-05-07  9:48         ` anon
2009-05-04 16:09 ` anon
2009-05-05 10:49   ` Rob Norris
2009-05-05 11:15     ` Georg Bauhaus
2009-05-05 11:43   ` Martin
2009-05-05 14:57     ` Adam Beneschan
2009-05-05 15:34       ` Jean-Pierre Rosen
2009-05-06 15:28         ` Adam Beneschan
2009-05-06 22:10           ` Randy Brukardt
2009-05-07  9:08           ` anon
2009-05-07 10:01             ` Georg Bauhaus
2009-05-07 11:22               ` anon
2009-05-07 12:08                 ` Martin
2009-05-07 13:34                 ` Georg Bauhaus
2009-05-07 16:26             ` Adam Beneschan
2009-05-08 10:17               ` anon
2009-05-12 22:55                 ` Adam Beneschan
2009-05-14  2:55                   ` anon
2009-05-14  8:04                     ` Martin
2009-05-14  8:39                     ` Martin
2009-05-14  8:45                       ` Martin
2009-05-14  9:34                       ` Ludovic Brenta [this message]
2009-05-14 10:05                         ` Martin
2009-05-14 12:38                           ` Georg Bauhaus
2009-05-14 15:34                     ` Adam Beneschan
2009-05-15 10:20                       ` anon
2009-05-15 11:19                         ` Martin
2009-05-05 20:48       ` anon
2009-05-05 21:01         ` Adam Beneschan
2009-05-06 11:30         ` Hibou57 (Yannick Duchêne)
2009-05-05 20:31     ` anon
2009-05-05 21:27       ` Martin
2009-05-06  8:41         ` anon
2009-05-06  9:14           ` Martin
2009-05-06 11:41             ` Georg Bauhaus
replies disabled

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