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,38ceb882eed41e1e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-31 19:45:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3BE0C552.8FD0ACD7@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Size and pack References: <9ff447f2.0110100005.2503bb00@posting.google.com> <3BC40DF2.9447F025@icn.siemens.de> <3bc41989.4285341@news.demon.co.uk> <5ee5b646.0110301750.38ba5bfd@posting.google.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 01 Nov 2001 03:45:35 GMT NNTP-Posting-Host: 209.86.207.5 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1004586335 209.86.207.5 (Wed, 31 Oct 2001 19:45:35 PST) NNTP-Posting-Date: Wed, 31 Oct 2001 19:45:35 PST Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Wed, 31 Oct 2001 19:41:37 PST (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:15524 Date: 2001-11-01T03:45:35+00:00 List-Id: Jeff Creem wrote: > > a little too broad. There ARE indeed times when you want a pragma pack and a > rep spec. Not for the record case but for arrays of items that have been rep > spec'ed. > > for example, the code fragment > > type My_Type is range 0 .. 3; > for My_Type'size use 2; > > type My_Array is array (1 .. 4) of My_Type; > pragma Pack (My_Array); -- Without this the following could fail > for My_Array'size use 8; Generally a compiler would use 4 bytes (or storage units) for My_Array, and without something to tell the compiler to use less storage for each component the size clause should be rejected. However, one can replace the pragma Pack with for My_Array'Component_Size use My_Type'Size; for My_Array'Size use My_Array'Length * My_Type'Size; to obtain the same effect without relying on Pack, which is allowed to be ignored. -- Jeff Carter "We call your door-opening request a silly thing." Monty Python & the Holy Grail