From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Bounded String question
Date: Tue, 8 Mar 2016 19:18:00 -0600
Date: 2016-03-08T19:18:00-06:00 [thread overview]
Message-ID: <nbntk9$nfp$1@loke.gir.dk> (raw)
In-Reply-To: nbl50v$8qq$1@dont-email.me
"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> wrote in message
news:nbl50v$8qq$1@dont-email.me...
> On 03/07/2016 04:16 PM, Randy Brukardt wrote:
>> "Xavier Petit" <xpetit@becoast.fr> wrote in message
>> news:56dc7e22$0$19749$426a34cc@news.free.fr...
>>
>> I don't know if this is relevant...
>>
>>> procedure Test_Bounded_String is
>>> package Bounded_String is
>>> type T (Max_Length : Natural := 100) is limited private;
>>
>> ...but a type like this can be completed with a non-limited type. That
>> might
>> prevent the compiler from applying a limited-only optimization. (Another
>> way
>> to say it is that this type is not inherently limited; non-limited views
>> can
>> exist of such types, and a non-limited view would need an
>> allocate-the-max
>> strategy [or a non-contiguous object].)
>
> The compiler knows the full type (which is limited) when it compiles the
> variable declaration and its associated elaboration code. Would it not be
> able
> to use that information?
I'd be speculating to say anything about someone else's compiler. (One thing
that we've all learned from the ARG is that what seems natural to one
compiler implementer can require some amazingly twisted implementation in
some other compiler. Best to never assume anything about some other
compiler.)
But I will say that it would depend on how the compiler handles objects. For
Janus/Ada, it is the type, not the object, that determines the memory
management strategy, so we have to tie that down fairly early.
And, in any case, the presence of a partial view subtly changes the
semantics of a type. (That's was added in Ada 2005 because the Ada 95 rule
had the unpleasant effect of making the details of the full type relevant to
the usage of the objects in some cases. It's rather a rather messy rule but
it was added to preserve the notion that all you need to know about is the
private type. (In Ada 95, you could get Constraint_Error when assigning two
objects of a type with no visible discriminants. Yuck.) So those rules as
well might cause a problem.
Randy.
next prev parent reply other threads:[~2016-03-09 1:18 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-10 22:00 Bounded String question Serge Robyns
2015-11-11 0:48 ` Bob Duff
2015-11-11 2:01 ` Jeffrey R. Carter
2015-11-11 15:34 ` Bob Duff
2015-11-11 17:36 ` Jeffrey R. Carter
2015-11-11 19:22 ` Bob Duff
2016-03-06 18:59 ` Xavier Petit
2016-03-07 23:16 ` Randy Brukardt
2016-03-08 0:08 ` Jeffrey R. Carter
2016-03-09 1:18 ` Randy Brukardt [this message]
2015-11-11 10:52 ` Serge Robyns
2015-11-11 13:43 ` Serge Robyns
2015-11-11 14:32 ` brbarkstrom
2015-11-11 16:08 ` Serge Robyns
2015-11-11 17:27 ` Jeffrey R. Carter
2015-11-11 20:06 ` Serge Robyns
2015-11-11 20:23 ` AdaMagica
2015-11-11 20:27 ` AdaMagica
2015-11-11 20:32 ` Serge Robyns
2015-11-11 20:40 ` AdaMagica
2015-11-12 17:31 ` Serge Robyns
2015-11-12 19:10 ` AdaMagica
2015-11-12 21:29 ` Randy Brukardt
2015-11-12 18:03 ` G.B.
2015-11-12 18:13 ` Serge Robyns
2015-11-12 18:14 ` Serge Robyns
2015-11-12 19:37 ` Randy Brukardt
2015-11-11 20:42 ` Jeffrey R. Carter
2015-11-12 16:59 ` Serge Robyns
2015-11-12 18:39 ` Jeffrey R. Carter
2015-11-12 21:19 ` Randy Brukardt
2015-11-12 21:27 ` Randy Brukardt
2015-11-12 22:32 ` Jeffrey R. Carter
2015-11-13 0:07 ` Randy Brukardt
2015-11-13 1:01 ` Jeffrey R. Carter
2015-11-11 15:41 ` Bob Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox