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,d02b0db8c2d7bd81 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: Representation Clauses for tagged types Date: 1998/08/26 Message-ID: <6s19hu$f3q@lotho.delphi.com>#1/1 X-Deja-AN: 384941011 Organization: Delphi Internet Services Newsgroups: comp.lang.ada Date: 1998-08-26T00:00:00+00:00 List-Id: There was a discussion of this recently, as I recall. My experience with three MS Windows targeted compilers is that letting the tag occupy the first 32 bits, works. for example_t use record x at 4 range .... But there's surely no guarantee. > Also, another question concerning this is can > I force the tag to be a certain bit size. The compiler and run-time-system need to put certain info (probably a pointer) into the tag. If they need 32 bits, you can't just toss out 29 of them. But are you sure you need to specify the tag representation at all? Presumably you aren't reading in a tagged record and its tag (which depends on the particular compiler, and quite likely is in fact an address in RAM) from an external device, or from a non-Ada program or OS. Similarly, you probably don't really want to send the tag to the non-Ada program or an external device. How about: type X_Values is range 0 .. 31; type Actual_Record_Type is record X : X_Values; end record; for Actual_Record_Type use record X at 0 range 3 .. 7; end record; type example_t is tagged record Content : Actual_Record_Type; end record; Then in your Ada program you have a tagged type example_t, but for external use you can do IO or whatever on Content, whose representation you control.