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=0.6 required=5.0 tests=BAYES_00,FROM_WORDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,aeab6b16387b2612 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-16 10:39:03 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.onemain.com!feed1.onemain.com!cyclone2.usenetserver.com!newscon06.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr11.news.prodigy.com.POSTED!not-for-mail From: "Ken Garlington" Newsgroups: comp.lang.ada References: <9itna2$i5b$1@news.tpi.pl> Subject: Re: How to do it in Ada ? Organization: ex-FlashNet, now Prodigy X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-Mimeole: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: NNTP-Posting-Host: 65.65.210.237 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr11.news.prodigy.com 995305042 6207069 65.65.210.237 (Mon, 16 Jul 2001 13:37:22 EDT) NNTP-Posting-Date: Mon, 16 Jul 2001 13:37:22 EDT Date: Mon, 16 Jul 2001 17:37:22 GMT Xref: archiver1.google.com comp.lang.ada:10006 Date: 2001-07-16T17:37:22+00:00 List-Id: Heck, if I were going to do it the natural Ada way, I'd say: with Ada.Command_Line; with Ada.Text_Io; -- for debug only procedure Main is -- N is the first argument, if it is specified and "reasonable". -- Otherwise, it defaults to the value 1 (one array element). function N return Positive is subtype OK_Range is Positive range 1 .. 65_535; -- 65,535 can be replaced with whatever is "reasonable" -- for an upper limit, or the range eliminated altogether. begin return OK_Range'Value(Ada.Command_Line.Argument(1)); exception when others => return 1; end N; X : array (1 .. N) of Integer := (others => 0); begin Ada.Text_Io.Put_Line("Hey! You've got an array of" & Natural'Image(X'Length) & " element(s)!"); -- do what you gotta do end Main;