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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Examining individual bytes of an integer Date: Wed, 17 Oct 2018 17:10:13 -0500 Organization: JSA Research & Innovation Message-ID: References: <9d90fa3e-f800-4086-bf97-a65474a8140a@googlegroups.com> <4ddbc9bf-0e2e-466d-8238-d8f709b985e1@googlegroups.com> <35f53cd9-4979-49b8-a5df-2c1cf0764507@googlegroups.com> Injection-Date: Wed, 17 Oct 2018 22:10:14 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="8375"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:54622 Date: 2018-10-17T17:10:13-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:pq6r7i$1o47$1@gioia.aioe.org... > On 2018-10-17 00:33, Randy Brukardt wrote: > >> That's the model for the entire compiler: all objects are >> statically sized, and if needed, the actual data is found by indirection. > > That makes me missing RM rule (not advice): for any instance of > > new X > > Allocate of the corresponding storage pool is called exactly once. I would fight that at every level, since it would make a useful implementation of discriminated records impossible. Ada has always been very clear that non-contiguous representations are allowed. It might make sense to introduce some sort of aspect to require a contigious representation for an array or record, so long as that's only required to be supported on sensible types. In particular, this type should work with raising Storage_Error or some other exception on all Ada compilers: type Rec (D : Natural) is record Arr : String (1 .. D); end record; C0Rec : constant Rec(0) := (D => 0, Arr => ""); C1Rec : constant Rec(1) := (D => 1, Arr => "R"); A_Rec : Rec := C0Rec; A_Rec := C1Rec; A_Rec := (D => 3, Arr => "RLB"); A type like this pretty much requires discontiguous representations and reallocation on assignment. Randy.