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!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Introductory Presentations, especially aimed at C++ programmers! Date: Fri, 9 Dec 2016 16:01:18 -0600 Organization: JSA Research & Innovation Message-ID: References: <1905815374.502825168.454102.laguest-archeia.com@nntp.aioe.org> <877f7b5llo.fsf@nightsong.com> NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1481320879 19230 24.196.82.226 (9 Dec 2016 22:01:19 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 9 Dec 2016 22:01:19 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:32705 Date: 2016-12-09T16:01:18-06:00 List-Id: "Paul Rubin" wrote in message news:877f7b5llo.fsf@nightsong.com... >> exponentially better than being prevented from overflowing a buffer is >> being able to figure out how to do >> declare >> B : Buffer (1 .. Just_The_Right_Size); > > Alternatively the buffer could be dynamically sized according to the > data. That's not in the Ada spirit because of the possible OOM and > memory allocation latency getting in the way of embedded realtime > applications, but for a workstation app it's perfectly workable. > Horses for courses. That's one possible way to use the API in question, since there's no way to find out beforehand how much data you'll need. (You could ask for the size ahead of time, but of course that's a potential race condition so it doesn't really help.) Randy.