comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada.Command_Line.Argument_Count question
Date: Fri, 18 Sep 2009 18:16:15 -0400
Date: 2009-09-18T18:16:15-04:00	[thread overview]
Message-ID: <wccab0rq4pc.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: gl77b59ft50tcacacrf5d37m65ksl7idaq@4ax.com

John McCabe <john@nospam.assen.demon.co.uk> writes:

> On Thu, 17 Sep 2009 22:12:17 -0700 (PDT), sjw <simon.j.wright@mac.com>
> wrote:
>
>>On Sep 17, 2:50�pm, John McCabe <j...@nospam.assen.demon.co.uk> wrote:
>>
>>> For example if, on the command line, I type:
>>>
>>> prog1.exe a b c
>>>
>>> Does Argument_Count() return 3 or 4? I haven't looked at this
>>> paragraph in detail, or what surrounds it, but "the number of
>>> arguments passed to the program invoking the function" sounds a bit
>>> vague. Is the "program invoking the function" the shell, or the
>>> program you're running?
>>
>>3.
>
>>The program you're running.
>
> For all implementations?

For all reasonable implementations.  It is possible to create a
conforming Ada implementation that does something weird, because
the RM leaves all this implementation-defined.  It has to, because
we can't know about all operating systems.  But for any operating
system that supports command-line arguments, you can count on the
Ada implementation NOT including the command name itself as one
of the arguments.

> I see that Ada.Command_Line.Command_Name returns the name of the
> program that's been run. On Gnat at least it all makes sense. Compared
> to C++ (MSVC) on Win32 for:
>
> printargs.exe 1 2 3
>
> I get..
>                Ada            C++
> Argument Count 3              4
> command name   printargs.exe  equiv. to argv[0]
> argument 1     1              1
> argument 2     2              2
> argument 3     3              3
>
> I guess, from the Annotated ARM, section A.15(22) & A.15(22a).

Right.

- Bob



  reply	other threads:[~2009-09-18 22:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-15 20:58 Ada.Command_Line.Argument_Count question 
2009-09-15 21:37 ` Gautier write-only
2009-09-16  6:21   ` 
2009-09-16 18:43   ` Keith Thompson
2009-09-22 19:52     ` Gautier write-only
2009-09-22 20:00       ` Hyman Rosen
2009-09-23  0:20         ` Gautier write-only
2009-09-23  1:07           ` Adam Beneschan
2009-09-23 13:03             ` Hyman Rosen
2009-09-23 16:06             ` Gautier write-only
2009-09-24  0:31               ` Björn Persson
2009-09-24  1:11                 ` Adam Beneschan
2009-09-25 12:25                   ` Stephen Leake
2009-09-15 21:55 ` Adam Beneschan
2009-09-16  6:20   ` 
2009-09-16 10:41 ` Jeffrey R. Carter
2009-09-17 13:50 ` John McCabe
2009-09-18  5:12   ` sjw
2009-09-18 15:03     ` John McCabe
2009-09-18 22:16       ` Robert A Duff [this message]
2009-09-21 15:09         ` John McCabe
2009-09-21 15:17           ` Dmitry A. Kazakov
2009-09-21 19:44           ` sjw
2009-09-22 11:01             ` John McCabe
replies disabled

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