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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,24d7acf9b853aac8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Sun, 22 Aug 2010 11:28:11 +0100 Organization: A noiseless patient Spider Message-ID: References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <4c6bc259$0$6887$9b4e6d93@newsspool2.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 22 Aug 2010 10:28:12 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="KCXegvZb5vh43D+f3BR6Ew"; logging-data="9967"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+T5VOqgR2HPQAkINXQbd0CBbMfUml0u3g=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:okhGG8IlF6ILUT1dZwkiGbUZaLQ= sha1:B4SaJqdV4of74cCE+VCFHTikYMQ= Xref: g2news1.google.com comp.lang.ada:13599 Date: 2010-08-22T11:28:11+01:00 List-Id: Natasha Kerensikova writes: > But then it means the following type allow some sort of dynamic array? > > type Dynamic_Whatever_Array (Size : Natural := 0) is > array (1 .. Size) of Whatever; > > > Then is there a simpler way to replace the object thanĀ : > > procedure Foo is > object : Dynamic_Whatever_Array; Unfortunately the way Ada does this is by allocating enough room for 'object' to hold any possible size -- 2**31 bytes -- this will break your stack! You could use a sensible max size and allocate on the heap for larger objects. Or you may be able to hold Dynamic_Whatever_Array instances in an Ada.Containers.Indefinite_.