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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,be97e82d84e1ded9 X-Google-Attributes: gid103376,public From: dewarr@my-dejanews.com Subject: Re: Packing Records Using Size Attribute Definitions Clauses Date: 1998/11/21 Message-ID: <73589m$pnj$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 414068746 References: <1998Nov18.230626.16278@nosc.mil> X-Http-Proxy: 1.0 x4.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Sat Nov 21 02:25:07 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1998-11-21T00:00:00+00:00 List-Id: In article , stt@houdini.camb.inmet.com (Tucker Taft) wrote: > Charles H. Sampson (claveman@fern.mil) wrote: > > : Did something happen between Ada 83 and Ada 95 affecting the abil- > : ity to pack a record by using a Size attribute definition clause? This > : is not one of the advertised incompatibilities, but I've tried my code > : on three Ada 95 compilers and they all reject it. > > Yes. A size clause is not the way to cause a record to be packed in Ada 95. > The pragma "pack" is for that. A size clause is a way to effectively > "confirm" that the record is the size you think it should be, > or perhaps to pad it out, but it is not the way to shrink it. > See RM95 13.3(53). The yes in Tuck's message is wrong here. There has been no change in the relevant language features between Ada 83 and Ada 95. Both language definitions recommend against implementations allowing implicit packing via the size clause, but do not prohibit this (highly undesirable) behavior. The difference is that in Ada 95, this implementation advice is explicit, in Ada 83 it was implicit (deducible from the intent of the RM, but not explicit. This was discussed in one of the Ada 83 AI's). Unfortunately, some Ada 83 compilers unwisely ignored the relevant AI and allowed this implicit packing with the result that in some cases you can get expensive implicit conversions happening, something that Ada was designed to avoid (that is indeed how you can deduce the intent in Ada 83 that such implicit packing should not occur!) In the Ada 95 world, compilers are behaving in a more reasonable manner. Use pragma Pack if you want to Pack! -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own