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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,6e64435d2a7280f2 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!postnews.google.com!o13g2000vbl.googlegroups.com!not-for-mail From: Gautier write-only Newsgroups: comp.lang.ada Subject: Re: Ada.Command_Line.Argument_Count question Date: Tue, 15 Sep 2009 14:37:31 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <4ab00009$0$282$14726298@news.sunsite.dk> NNTP-Posting-Host: 83.79.83.208 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1253050652 15438 127.0.0.1 (15 Sep 2009 21:37:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 15 Sep 2009 21:37:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o13g2000vbl.googlegroups.com; posting-host=83.79.83.208; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.21 Safari/532.0,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8335 Date: 2009-09-15T14:37:31-07:00 List-Id: On 15 sep, 22:58, Thomas L=F8cke 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 =93number of arguments=94 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! Always interesting to test a bit with that: -- Displays the arguments given with Ada.Command_Line; use Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; procedure Args is begin for I in 1..Argument_Count loop Put_Line(Integer'Image(I) & " [" & Argument(I) & ']'); end loop; Put("Press Enter"); Skip_Line; end; Cheers _________________________________________________________ Gautier's Ada programming -- http://sf.net/users/gdemont/ NB: For a direct answer, e-mail address on the Web site!