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-Thread: 103376,2ac407a2a34565a9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.135.231 with SMTP id pv7mr3605892pbb.8.1330556364811; Wed, 29 Feb 2012 14:59:24 -0800 (PST) Path: h9ni24504pbe.0!nntp.google.com!news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Array Help? Date: Wed, 29 Feb 2012 17:59:24 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <10615783-d4a9-4cbd-8971-53ba1100d6a0@b18g2000vbz.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1330556364 31571 192.74.137.71 (29 Feb 2012 22:59:24 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 29 Feb 2012 22:59:24 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:CI1wOOPvSsawW0unR4/UuwUvtas= Content-Type: text/plain; charset=us-ascii Date: 2012-02-29T17:59:24-05:00 List-Id: Jeffrey Carter writes: > My 1st programming job, using FORTRAN 66, dealt with tree-ring data. We > had data from 1600 to 1970. Calculating the correct array index for a > year was a rich source of bugs for us; if we'd been able to have the > lower bounds be 1600 rather than 1 life would have been a lot easier. Indeed. In Ada that would be a constrained array. I was talking about unconstrained arrays. There are really two different kinds of arrays: sequences and mappings. A sequence represented as an array is usually an unconstrained type (but can be constrained if you know the length), and the index subtype is almost always a signed integer, and usually starts at 0 or 1. A mapping represented as an array is almost always constrained, and the index subtype might be an enumeration, or something like your 1600..1970 above. The index type should almost never be modular, especially when unconstrained. - Bob