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: a07f3367d7,5d624451bcaff335 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newspeer.monmouth.com!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Null Range in Unconstrasined Array Date: Tue, 01 Sep 2009 11:34:30 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <76a9c14b-c573-4fd4-bbd8-7ab3bd078d79@j9g2000prh.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: pcls6.std.com 1251819274 10040 192.74.137.71 (1 Sep 2009 15:34:34 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 1 Sep 2009 15:34:34 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:DonGgNWRFn14zfxWNkFGc9D89qQ= Xref: g2news2.google.com comp.lang.ada:8102 Date: 2009-09-01T11:34:30-04:00 List-Id: Adam Beneschan writes: > On Aug 31, 6:28�pm, Rick wrote: >> If I have an unconstrained array type 'My_Array_Type' and declare an >> instance of it as: >> >> My_Array : My_Array_Type (1 .. 0); >> >> then the LRM tells me it is a null range: >> >> 3.5 (4): A range with lower bound L and upper bound R is described by >> �L .. R�. If R is less than L, then the range is a null range, and >> specifies an empty set of values. >> >> What, exactly, is My_Array (forgive the language) pointing to? Well, arrays don't "point". >> Is any memory allocated to My_Array? > > Most likely, no. Randy gave a reason why a compiler might want to > allocate a little bit of space for the array; but even if it does, > it's memory that will never be used. Randy's reason applies only if the array is aliased, which the above one is not. There's no reason the compiler has to allocate any space for My_Array above. If we have: My_Array : My_Array_Type (1 .. 0); X : Boolean; it is entirely possible (likely even) that My_Array'Address = X'Address. Randy's concern about access values does not apply to addresses. Usually, empty arrays are not statically known to be empty, though. In that case, some space might be used to store the bounds. >...Any attempt to refer to My_Array > (X), no matter what X is, will raise Constraint_Error. Right. - Bob