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 Path: g2news2.google.com!news2.google.com!news.glorb.com!guardian.oit.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ada.Command_Line.Argument_Count question Date: Fri, 18 Sep 2009 18:16:15 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <4ab00009$0$282$14726298@news.sunsite.dk> <2191b7e4-c09d-42fe-b446-1ca01e44c1ba@b18g2000vbl.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls4.std.com 1253312175 9141 192.74.137.71 (18 Sep 2009 22:16:15 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 18 Sep 2009 22:16:15 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:LZRDQFPwxzI4+TW1DW/7ZwI516Y= Xref: g2news2.google.com comp.lang.ada:8387 Date: 2009-09-18T18:16:15-04:00 List-Id: John McCabe writes: > On Thu, 17 Sep 2009 22:12:17 -0700 (PDT), sjw > wrote: > >>On Sep 17, 2:50�pm, John McCabe 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