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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.169.69 with SMTP id x5mr1584252iti.48.1510133550576; Wed, 08 Nov 2017 01:32:30 -0800 (PST) X-Received: by 10.157.85.8 with SMTP id l8mr71322oth.7.1510133550430; Wed, 08 Nov 2017 01:32:30 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!xmission!feeder.erje.net!2.us.feeder.erje.net!bloom-beacon.mit.edu!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!ottix-news.ottix.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!186no100412itu.0!news-out.google.com!193ni1751iti.0!nntp.google.com!l196no1030413itl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 8 Nov 2017 01:32:30 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=97.117.246.21; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG NNTP-Posting-Host: 97.117.246.21 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1c20fe22-ba3c-4db4-a18d-c922e3d04de5@googlegroups.com> Subject: Trying to declare an array from the heap from inside a record declaration From: Jerry Injection-Date: Wed, 08 Nov 2017 09:32:30 +0000 Content-Type: text/plain; charset="UTF-8" Xref: feeder.eternal-september.org comp.lang.ada:48766 Date: 2017-11-08T01:32:30-08:00 List-Id: Several years ago a kind and clever person on this list showed me how to allocate possibly large arrays from the heap without breaking functions which expect just normal arrays. Using the Numerics features as an example, it might look like this... M, N : Integer := 100; -- Included here for clarity. x_Ptr : Real_Vector_Access := new Real_Vector(M .. N); x : Real_Vector renames x_Ptr.all; ... and subprograms which expect a Real_Vector have no problems with this x. Now, I want to put this kind of thing inside a record declaration, but the compiler complains. I'm trying this: type foo(M, N : Integer) is record y : Real_Vector(M .. N); x_Ptr : Real_Vector_Access := new Real_Vector(M .. N); x : Real_Vector renames x_Ptr.all; end record; y is accepted as OK but the x_Ptr line generates "unconstrained subtype in component declaration" and the next line generates "missing ";"". Jerry