From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Lower bounds of Strings Date: Wed, 13 Jan 2021 15:08:04 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <1cc09f04-98f2-4ef3-ac84-9a9ca5aa3fd5n@googlegroups.com> <37ada5ff-eee7-4082-ad20-3bd65b5a2778n@googlegroups.com> <26cac901-b901-4c4f-aba9-eab6cbd2a525n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 13 Jan 2021 14:08:04 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="93fe0c44792881410d3a8a39d05e6191"; logging-data="3996"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qIYDkh6UVrahmWQtY/dMjb6crrBckVbE=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 Cancel-Lock: sha1:fZnO38TFJ8x2SuVb8Do8y1aPOJU= In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:61117 List-Id: On 1/12/21 9:12 AM, Randy Brukardt wrote: > N2 : String(314 .. 25); > > And it takes code to figure this out at runtime if either bound is nonstatic > (which is usually the case with slices). And you still have to store the > bounds (you can still ask for the bounds of N2, and one better get 314 and > 25, but the length is still zero). I don't think I have ever cared what values 'First and 'Last return for a null array. While I was aware that such super-null ranges were possible, I presumed that some canonical values were used for the bounds of a null array, regardless of the actual bounds given. For a 1-D array X with X'Length = 0, my uses of the bounds of X are usually one of I in X'range ----- I := X'First; followed by comparison to X'Last ----- comparison of X'Length to zero ----- if X is a string type, comparison of X to "" Are there real-world cases where retrieving the actual bounds given is necessary? -- Jeff Carter "Your mother was a hamster and your father smelt of elderberries." Monty Python & the Holy Grail 06