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,LOTS_OF_MONEY 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 17:58:06 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: byhoe@greenlime.com (Adrian Hoe) Newsgroups: comp.lang.ada Subject: Re: Size and pack Date: 31 Oct 2001 17:58:05 -0800 Organization: http://groups.google.com/ Message-ID: <9ff447f2.0110311758.2be52637@posting.google.com> References: <9ff447f2.0110100005.2503bb00@posting.google.com> <3BC40DF2.9447F025@icn.siemens.de> <3bc41989.4285341@news.demon.co.uk> <5ee5b646.0110301750.38ba5bfd@posting.google.com> NNTP-Posting-Host: 210.186.172.45 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1004579886 5162 127.0.0.1 (1 Nov 2001 01:58:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 1 Nov 2001 01:58:06 GMT Xref: archiver1.google.com comp.lang.ada:15521 Date: 2001-11-01T01:58:06+00:00 List-Id: "Jeff Creem" wrote in message news:... > OK.. I know I am going to regret this since whenever I question Robert I > usually am wrong however > without using the complete context of this thread, I believe Roberts > statement is actually > 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; > > > The pragma pack is needed I believe because the rep spec on My_Array can > be rejected without it (At least it has been rejected by some compilers and > I forget > the exact rule but it had something to do with the final rep spec not being > allowed to > change the layout of the items within the array). > > Having said that VADS used to compile this without the pragma pack. Green > Hills did not. > I *THINK* GNAT does allow it to go through without the rep spec for several > versions now. But, why the differenct implementation by these compilers' vendors? I thought Ada is a standardized language regardless of platforms. Of course, a problem like whether to use "pragma pack" or not in the above Jeff's example "supposed" not to arise if Ada is standardized. Oh... I am getting quite confusing now, and not to mention Ada newbies! > > "Robert Dewar" wrote in message > news:5ee5b646.0110301750.38ba5bfd@posting.google.com... > > john.mccabe@emrad.com.nospam (John McCabe) wrote in message > news:<3bc41989.4285341@news.demon.co.uk>... > > > 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 > > > > No, that's pointless, if you use a complete rep clause, then it is > > redundant to use pragma Pack since it won't have > > any effect.