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,b5cd7bf26d091c6f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!z37g2000yqb.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Reading the while standard input into a String Date: Fri, 10 Jun 2011 01:22:31 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2771e7df-4c09-4eb7-957e-81a2a0bd2f8a@z37g2000yqb.googlegroups.com> References: <0fc4860c-6b14-493a-99a4-0b17e736ec48@glegroupsg2000goo.googlegroups.com> <959s61F40sU1@mid.individual.net> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1307694151 22827 127.0.0.1 (10 Jun 2011 08:22:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 10 Jun 2011 08:22:31 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z37g2000yqb.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESRCNK X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:20701 Date: 2011-06-10T01:22:31-07:00 List-Id: On Jun 9, 1:46=A0am, "Randy Brukardt" wrote: > "Niklas Holsti" wrote in message > > news:959s61F40sU1@mid.individual.net... > ... > > > The compiler can ignore pragma Pack in the sense that the compiler can > > allocate memory for the data type in the same was as if there were no > > pragma Pack. That is, the pragma does not have to result in a smaller > > memory lay-out. The pragma only asks the compiler to *try* to minimize = the > > size, but the compiler does not have to try very hard... or at all. > > > If you want to be sure that pragma Pack has some (desired) effect, you > > should define the 'Size attribute of the type. If the compiler cannot p= ack > > the type into the given size, it must report a compile-time error. > > In this particular case, where a specific representation of an array is > desired, you have to specify 'Component_Size on the array type. Pack does= n't > necessarily specify a particular representation, and even when it does, i= t > is much better to explicitly state that you want 16 bit components (rathe= r > than just "smaller" components). > > In the original example, the type should have been declared: > > =A0 =A0 type Buffer is array (1..32) of Interfaces.Unsigned_16 > =A0 =A0 =A0 =A0 with Component_Size =3D> 16; > > presuming you have an Ada 2012 compiler. If not, fall back on those ugly > attribute definition clauses: > > =A0 =A0 type Buffer is array (1..32) of Interfaces.Unsigned_16; > =A0 =A0 for Buffer'Component_Size use 16; > > (Ugly because you have to repeat the type name and because they can get > separated from the type.) > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Randy. Randy / Bob, Thanks for these answers...looking forward to Ada2012 even more now! :-) -- Martin