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,df854b5838c3e14 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Gripe about Ada, rep specs that won't. Date: 1996/03/25 Message-ID: #1/1 X-Deja-AN: 144182782 references: <00001a73+00002504@msn.com> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-03-25T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >Hmmm! Let's see what that para actually says: > > 8 For a packed record type, the components should be packed as > tightly as possible subject to the Sizes of the component > subtypes, and subject to any record_representation_clause that > applies to the type; the implementation may, but need not, > reorder components or cross aligned word boundaries to improve > the packing. A component whose Size is greater than the word > size may be allocated an integral number of words. > >Note the "SUBJECT TO THE SIZE" statement here. OK, so we know Boolean'Size = 1. So the two-Boolean-components example has to be packed "as tightly as possible", given 2 1-bit components. To me, that says it has to be 2 bits. Now, if we put that record inside *another* record, "as tightly as possible" means 2 bits for the inner record, not 8 bits. I would say that the above para implies that 'Size = 2 for the two-Boolean-components example record. Otherwise, what on earth would "as tightly as possible" mean? >... Bob you wrote this, not me :-) :-) > (a) implementations are free to reject *any* size clause for a record subtype Agreed, and perhaps the ARG should say something about that. > (b) implementations are free to choose whatever size they like for record > subtypes Disagree. (And I think this is the more important part of it.) If it's packed, then you have to obey the rules for pragma Pack, not just the rules for 'Size. >You appeal to 13.2(8) again, but the appeal is in vain, because 12.3(8) is >stuck with the arbitrary size chosen by the compiler. What should this size >be? We (GNAT) are not quite sure. Right now, we choose a default size of >8, but it can be changed to 2 on demand using the size clause. Sounds wrong to me. To me, pragma Pack isn't very useful if you have to use rep clauses in addition to declare the component sizes. >.>Keep in mind that my lax view on this applies only to chapter-13-ish >.>stuff -- the high level features of the language are different -- they >.>should be standardized more strictly. >I find that too lax! Even for Chapter 13. The trouble is that the ACVC >test effort is now much weaker than it was for even Ada 83 in the area >of rep clauses, because it cannot go beyond the requirements, now that >they are spelled out. Still perhaps the ARG can correct this situation. The Ada 83 ACVC did not require any particular packing of records, and Ada 83 compilers exist that totally ignore pragma Pack on records. To me, that's an unacceptable situation. If you think that situation is fine, then I can see why you argue that the RM83 wording is better. But if you really want compilers to implement packed records, then I think you have to define some minimal amount of packing. Having done that, I think you can trust the compiler vendors to go beyond that minimum where it makes sense. - Bob