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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5117b1b6391a0e06 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: A simple ADA puzzle (I haven't the answer) References: <_Q%zc.7117$Wr.4869@newsread1.news.pas.earthlink.net> <5ad0dd8a.0406181007.775eae12@posting.google.com> In-Reply-To: <5ad0dd8a.0406181007.775eae12@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <8EMAc.5698$w07.1296@newsread2.news.pas.earthlink.net> Date: Sat, 19 Jun 2004 01:27:32 GMT NNTP-Posting-Host: 63.184.33.102 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.pas.earthlink.net 1087608452 63.184.33.102 (Fri, 18 Jun 2004 18:27:32 PDT) NNTP-Posting-Date: Fri, 18 Jun 2004 18:27:32 PDT Xref: g2news1.google.com comp.lang.ada:1677 Date: 2004-06-19T01:27:32+00:00 List-Id: Wojtek Narczynski wrote: > Please allow a small quiz: how much memory does an Unbounded_String > instance take, for a string "a" (of lenght 1 char)? There are many responses to this. One is: it depends on the compiler. No implementation is specified for Unbounded_String. Another is: Why do you care? If you have strict memory limitations, you should probably not be using a general-purpose component anyway. If you don't, then it's very unlikely to make a difference, so you shouldn't worry about it unless it actually proves to be a problem. A 3rd is: Not withstanding #1, an obvious implementation is a controlled type containing a String_Access. The language requires such an implementation to occupy space for one access value, and whatever space is required by the string it designates. This is exactly the same amount of space as using explicit access values, without the possibilities for errors they introduce. (While a controlled type is a tagged type, there is no requirement that tags actually be stored, and in the case of Unbounded_String, there is no need to store the tag.) -- Jeff Carter "When danger reared its ugly head, he bravely turned his tail and fled." Monty Python and the Holy Grail 60