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,3ea3c3aa71aa3a1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-27 09:02:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsgate.duke.edu!newsfeed!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Questions Date: 27 Apr 2003 12:02:35 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <69uaavobiedlcb4gr0lro4t41nu41t2k2f@4ax.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1051459355 8077 199.172.62.241 (27 Apr 2003 16:02:35 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 27 Apr 2003 16:02:35 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:36647 Date: 2003-04-27T12:02:35-04:00 List-Id: "Nick Roberts" writes: > "Robert A Duff" wrote in message > news:wcc7k9mi4rb.fsf@shell01.TheWorld.com... > > > Jakub Zawadzki writes: > > > > > It's guestions from my friend > > > Emaix>I have a question. Does a String(1..X) occupy X bytes always, no > > > Emaix> matter what actual length the string has got? > > > > Heh? The length of the string *is* X. So yes, it occupies X bytes > > (plus whatever dope is necessary). > > Sometimes a srting such as, for example, defined by String(1..10), will > occupy 20 or 40 bytes (plus 'dope information'), unless pragma Pack is > applied to it. This is because normally the compiler will allocate one > 'storage element' per character (so as to maximise speed of access to it) > and on some target machines storage elements are 16 or 32 bits in size. > (Some unusual machines have other sizes of storage element.) First, I'm willing to bet that the OP is not interested in such machines. Second, pragma Pack applies to type String, in all implementations of Ada, and the requirements on Pack mean 4-chars-per-word on a 32-bit-word-addressable machine. I think you (Nick) and I have both missed what the OP is getting at. Perhaps he should clarify the question, perhaps with an example that illustrates the point... - Bob