comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Access to aliased string declaration question.
Date: 1999/06/10
Date: 1999-06-10T00:00:00+00:00	[thread overview]
Message-ID: <7jn9me$66s$1@nnrp1.deja.com> (raw)
In-Reply-To: 375ED457.A85A462B@Boeing.com

In article <375ED457.A85A462B@Boeing.com>,
  Rex Reges <Rex.R.Reges@Boeing.com> wrote:
> Example program below doesn't compile...
>
> with Text_IO ;
> use  Text_IO ;
>
> procedure Borg is
>
>    -- Example of ragged arrays using heap and declared values.

<<code snipped>>

a very common error, common enough that we added some extra
warnings to GNAT to help understand the error. Your program
now generates warnings like:

    23.   Static_Dalek_String_3 : aliased String( 1..12 ) :=
                                                 "Exterminate!";
          |
        >>> warning: aliased object has explicit bounds
        >>> warning: declare with explicit initialization
        >>> warning: for use with unconstrained access

If you give explicit bounds, then you cannot use an
unconstrained access. This confusing rule results from the
fact that the explicit bounds make the nominal subtype of
the object constrained. Just remove the bounds and all will
be well.

The reason for this (in my opinion highly dubious) bit of
language design is to allow the compiler to save space and
not generate a template for the bounds in this case. I
personally think this was a case of the design being over-
influenced by a very minor space optimization issue.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




  reply	other threads:[~1999-06-10  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-09  0:00 Access to aliased string declaration question Rex Reges
1999-06-10  0:00 ` Robert Dewar [this message]
1999-06-10  0:00 ` Matthew Heaney
1999-06-10  0:00   ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox