From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:4756:: with SMTP id k22mr887466qtp.193.1621277044767; Mon, 17 May 2021 11:44:04 -0700 (PDT) X-Received: by 2002:a25:cb56:: with SMTP id b83mr1755613ybg.73.1621277044463; Mon, 17 May 2021 11:44:04 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 17 May 2021 11:44:04 -0700 (PDT) Injection-Info: google-groups.googlegroups.com; posting-host=99.10.228.144; posting-account=AgomvAoAAAAj6rtZlNDUf1S1XVXbXDpg NNTP-Posting-Host: 99.10.228.144 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Better way to fill Storage_IO? From: Michael Hardeman Injection-Date: Mon, 17 May 2021 18:44:04 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:61998 List-Id: So I've been messing around with the new Ada 2020 package Ada.Streams.Stora= ge.Bounded/Unbounded; and if I'm understand it correctly it allows you to t= reat your program's memory like a stream without having to open file descri= ptors (which should make it faster?). That seems like a powerful abstractio= n to me and a great addition to the language. with Ada.Text_IO; use Ada.Text_IO; with Ada.Streams; use Ada.Streams; with Ada.Streams.Storage.Unbounded; use Ada.Streams.Storage.Unbounded; procedure Test is Test : String :=3D "040b2cec765b4bbbdb29d83b6dcaf776"; Test_Stream : aliased Stream_Type; begin String'Write(Test_Stream'Access, Test); for I in 1 .. Element_Count (Test_Stream) loop declare C : Character; begin Character'Read (Test_Stream'Access, C); Put (C); end; end loop; end Test; I was wondering if we could find a better way to fill the stream other than= writing the variables into it? Can anyone figure out a good way to just st= ream a variable's bytes directly?