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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:ce10:: with SMTP id p16-v6mr2842651iob.87.1527342964069; Sat, 26 May 2018 06:56:04 -0700 (PDT) X-Received: by 2002:a9d:276e:: with SMTP id r101-v6mr433740ota.9.1527342963893; Sat, 26 May 2018 06:56:03 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.69.MISMATCH!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!v8-v6no3257521itc.0!news-out.google.com!f20-v6ni2928itd.0!nntp.google.com!v8-v6no3257515itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 26 May 2018 06:56:03 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.113.16.86; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 76.113.16.86 References: <6ff31dc6-31e7-4755-bda0-1b53fa02f31f@googlegroups.com> <1fd5b10f-8dc1-4b85-89e4-205f0a7ef67d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3f4f6e44-0d4c-4fb7-98df-b9c75ab18d68@googlegroups.com> Subject: Re: Interfaces.C.Strings chars_ptr memory management strategy From: Shark8 Injection-Date: Sat, 26 May 2018 13:56:04 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2412 X-Received-Body-CRC: 3676445702 Xref: reader02.eternal-september.org comp.lang.ada:52697 Date: 2018-05-26T06:56:03-07:00 List-Id: On Saturday, May 26, 2018 at 6:45:01 AM UTC-6, NiGHTS wrote: > On Friday, May 25, 2018 at 10:52:55 PM UTC-4, Shark8 wrote: > > On Friday, May 25, 2018 at 4:22:13 PM UTC-6, NiGHTS wrote: > > > > > > Here is just a quick and sloppy idea I had on how to tackle my problem. > > > > > > str : chars_ptr := New_String (" "); > > > > > > I find the first line quite ugly. I'm sure there is an easier way to create a large empty string but I can't seem to come up with an elegant way to do it. > > > > > > Something like this? > > Big_String : chars_ptr := New_String( (1..200 => ' ') ); > > Thanks, It was on the tip of my brain I just for some reason couldn't put it together quite right. It happens. If you're going to be using this a lot I'd recommend a generic-wrapper something like: GENERIC Max_Size : Natural; FUNCTION Buffer_String Return Chars_Ptr; FUNCTION Buffer_String Return Chars_Ptr IS ( New_String( (1..Max_Size => ' ') ) ); Or maybe a package.