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-10 23:36:46 PST Path: archiver1.google.com!news1.google.com!postnews1.google.com!not-for-mail From: byhoe@greenlime.com (Adrian Hoe) Newsgroups: comp.lang.ada Subject: Re: Size and pack Date: 10 Oct 2001 23:36:46 -0700 Organization: http://groups.google.com/ Message-ID: <9ff447f2.0110102236.712cb9ea@posting.google.com> References: <9ff447f2.0110100005.2503bb00@posting.google.com> <3BC40DF2.9447F025@icn.siemens.de> <3bc41989.4285341@news.demon.co.uk> NNTP-Posting-Host: 210.186.172.215 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1002782206 22829 127.0.0.1 (11 Oct 2001 06:36:46 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 11 Oct 2001 06:36:46 GMT Xref: archiver1.google.com comp.lang.ada:14217 Date: 2001-10-11T06:36:46+00:00 List-Id: john.mccabe@emrad.com.nospam (John McCabe) wrote in message news:<3bc41989.4285341@news.demon.co.uk>... > On Wed, 10 Oct 2001 10:59:30 +0200, Alfred Hilscher > wrote: > > Sorry I missed the original post but... > > >> Why this happens? Can I use representation clause instead of pragma > >> pack? If both methods work, which is the best approach and why? > > Your best bet would be to use as many representation attributes as are > necessary. In general I would use both a representation clause and > pragma pack on an item such as this, and possibly an alignment clause, > to guarantee as much as possible that the record layout in memory is > the way that you want it. I investigated the memory location of every components in record. The memory location (byte sequences which have been allocated) is of no difference if I applied: 1. pragma pack 2. representation clauses 3. both pragma pack and representation clauses. What kind of assurance the compiler can offer if we use the above approach? What is the portability issue (if any) from a 32-bit to 64-bit processor? Also, if the insertion of unused bytes by the compiler is to optimize, what could it be? Speed or space? Adrian