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,2203a21a136b39cc X-Google-Attributes: gid103376,public From: Viqar Abbasi Subject: Re: Fortran's Equivalence Date: 1997/04/07 Message-ID: <3349165C.3B93@cae.ca>#1/1 X-Deja-AN: 231379984 References: <333840D1.7B12@cae.ca> <5hbcdn$i1h@top.mitre.org> Organization: CAE Electronics Ltd Newsgroups: comp.lang.ada Date: 1997-04-07T00:00:00+00:00 List-Id: Hi, from the original poster... :) I've appreciated this dicussion on the "best" way to implement overlays. One thing that I forgot to mention was that I am confined to the Ada 83 environment, regardless of platform. So, I am attempting a conscious effort to enforce "old-style Ada 83 thinking". My original reason for this post was because when I received the code, it used address clause overlays. However, on my GNAT 3.07 for SGI, the overlaying didn't work (or at least, that particular code have the wrong results). So, I added a routine for bit swapping, (localizing the effect of changing machines to that one small routine), and then proceeded with Unchecked_Conversion. Later, when I downloaded GNAT 3.09, I found that it offered a whole new spectrum of address clause flexibility. A quick test showed me that the old address clause overlay would work. So, I thought I'd ask about the "preferred method" to do something which I knew is dangerous. (And actually, I've never used EQUIVALENCE in a Fortran program... But I knew about it. :) << there's the Prologue :) >> << Questions (this should be a standardized form) >> Can someone please explain to me the effect of representation clauses when doing these overlays? For example, record My_Record is A: some_type; B: some_other_type; C: still_another_type; end record; for My_Record_Type'Size use 32; for My_Record_Type use record A at 0 range 0 .. 14; B at 0 range 15 .. 24; C at 0 range 25 .. 31; end record; Does "range 0 .. 14" mean the Most Signicant Bits? Or does it mean "Left most bits"? This will clearly have an impact on my overlays. If I'm going to move bits arouund, then I don't want to have to change the record representation clauses... Will I be able to avoid it, by only changing my bit-manipulation routine, depending on my machine? Thanks for being here... :) V.