comp.lang.ada
 help / color / mirror / Atom feed
From: Jere <jhb.chat@gmail.com>
Subject: Re: limited agregate and limited components default initialization
Date: Sat, 31 Mar 2018 18:12:50 -0700 (PDT)
Date: 2018-03-31T18:12:50-07:00	[thread overview]
Message-ID: <a8d82c66-8884-4fc3-b422-c6a024b30989@googlegroups.com> (raw)
In-Reply-To: <fc00973e-ffa0-42b7-9872-5971e5e915c2@googlegroups.com>

On Saturday, March 31, 2018 at 8:52:39 PM UTC-4, Jere wrote:
> On Saturday, March 31, 2018 at 7:36:59 PM UTC-4, Jean-Claude Rostaing wrote:
> > Why does a component declaration like that:
> > type Item_Accessor (Item: not null access Item_type) is limited record
> >       Ref: Item_access := SET(Item_Record'(Item => ITEM.all, others => <>));
> >    end record;
> > unconstrained subtype in component declaration
> > ? ITEM is limited but IS constrained by the default initialisation
> > It forced me to add the function DEFAULT_INITIALIZATION as a parameter, which I would prefer to not to. But since the result is the same, I'll drop it.
> > Item (and the article it is in) is never meant to be left uninitialized.
> > 
> > Also, how to get rid of the problem with
> > function Set (Value: in Item_type) return Smart_Pointers is
> >      (Smart_Pointers'(Controlled with Node => new Accessor_type'(Data => new Item_type'(Value), Count => 1)));
> > which gives :Initialization not allowed for limited types.
> > So an aggregate like this is not counted as a "limited agregate" ??
> 
> I may be misunderstanding you, but if Item is a limited type with a default
> discriminant, it is "unconstrained" since the ada compiler cannot know
> at compile time what the actual size will be.
> 
> See:
> https://gcc.gnu.org/onlinedocs/gnat_rm/The-Size-of-Discriminated-Records-with-Default-Discriminants.html

Actually, the limited might make it ok, but I seem to remember it still being 
considered unconstrained from a language point of view.  Perhaps a language 
lawyer type can make a better comment.


  reply	other threads:[~2018-04-01  1:12 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-31 23:36 limited agregate and limited components default initialization Jean-Claude Rostaing
2018-04-01  0:52 ` Jere
2018-04-01  1:12   ` Jere [this message]
2018-04-01  1:16   ` Jean-Claude Rostaing
2018-04-01  1:34     ` Jere
2018-04-01  2:07       ` Jean-Claude Rostaing
2018-04-01  2:40         ` Jere
2018-04-01  2:54           ` Jere
2018-04-01  3:14         ` Jere
2018-04-01  3:31           ` Jere
2018-04-01  9:32         ` Jacob Sparre Andersen
2018-04-01 12:58           ` Jean-Claude Rostaing
2018-04-01 13:33 ` Dmitry A. Kazakov
2018-04-01 15:46   ` Jean-Claude Rostaing
2018-04-01 15:53     ` Jean-Claude Rostaing
2018-04-01 15:54       ` Jean-Claude Rostaing
2018-04-01 21:31       ` Dmitry A. Kazakov
2018-04-02  3:44         ` Randy Brukardt
2018-04-02 11:25           ` Jean-Claude Rostaing
2018-04-02 12:11             ` Dmitry A. Kazakov
2018-04-02 12:15             ` Jean-Claude Rostaing
2018-04-02 21:37             ` Randy Brukardt
2018-04-03 17:01               ` Jeffrey R. Carter
2018-04-05 10:27           ` AdaMagica
2018-04-02  3:42     ` Randy Brukardt
2018-04-01 22:52 ` Jean-Claude Rostaing
2018-04-01 23:36   ` Jean-Claude Rostaing
2018-04-01 23:39     ` Jean-Claude Rostaing
2018-04-02 18:19       ` Jere
2018-04-02 18:50         ` Dmitry A. Kazakov
2018-04-02 19:46           ` Jere
2018-04-02 19:59             ` Dmitry A. Kazakov
2018-04-02 21:03               ` Jean-Claude Rostaing
2018-04-03  8:14                 ` Dmitry A. Kazakov
2018-04-03  1:27             ` Dennis Lee Bieber
2018-04-02 22:39     ` Robert I. Eachus
2018-04-03 18:18 ` Jean-Claude Rostaing
2018-04-03 18:28   ` Jean-Claude Rostaing
2018-04-03 19:18   ` Jeffrey R. Carter
2018-04-03 19:25     ` Jean-Claude Rostaing
2018-04-03 20:12       ` Jeffrey R. Carter
2018-04-03 22:37         ` Jean-Claude Rostaing
2018-04-04  2:18   ` Jere
replies disabled

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