comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst-u@mib.org>
Subject: Re: Ada.Command_Line.Argument_Count question
Date: Wed, 16 Sep 2009 11:43:07 -0700
Date: 2009-09-16T11:43:07-07:00	[thread overview]
Message-ID: <lnk4zyenno.fsf@nuthaus.mib.org> (raw)
In-Reply-To: e5f2d04a-5dc9-4944-9158-1411fdfb8d99@o13g2000vbl.googlegroups.com

Gautier write-only <gautier_niouzes@hotmail.com> writes:
> On 15 sep, 22:58, Thomas Løcke wrote:
>> The RM has this to say about Argument_Count:
>> "If the external execution environment supports passing arguments to a
>> program, then Argument_Count returns the number of arguments passed to
>> the program invoking the function. Otherwise it returns 0. The meaning
>> of “number of arguments” is implementation defined."
>>
>> I'm wondering what that last sentence mean? Is the RM trying to tell me
>> that Argument_Count cannot be trusted to yield the same result on
>> different systems (Unix, BSD, Windows, Linux and so on)?
>
> Perhaps... And it the behaviour is compiler-dependent too!
> Some systems will give 2 for ["a b" c]; others, 3 (maybe only DOS on
> that!).
> Some compilers will always return [*.adb] as is, others (GNAT) will
> return one argument for each file corresponding to that pattern, or
> still "*.adb" if there is no such file!
[...]

The behavior you describe has nothing to do with the compiler, at
least not on Unix-like systems.  If you type
    ./my_program *.adb
in a Unix shell, my_program will see a list of file names; it will
have no way to know that the list is the result of expanding a
wildcard expression.  All the processing happens in the shell.  And of
course programs can be invoked by other programs, not just by the
shell.

On other systems, though, the Ada.Command_Line implementation might
(optionally?) do some additional processing.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"



  parent reply	other threads:[~2009-09-16 18:43 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 [this message]
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
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