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,65f09e2d2d4dad56,start X-Google-Attributes: gid103376,public From: "Marin D. Condic" Subject: Representation Clauses And Freezing Date: 2000/07/17 Message-ID: <3973192E.E7337814@acm.com>#1/1 X-Deja-AN: 647342764 Content-Transfer-Encoding: 7bit Organization: Quadrus Corporation X-Sender: "Marin D. Condic" (Unverified) X-Server-Date: 17 Jul 2000 14:33:30 GMT Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-07-17T14:33:30+00:00 List-Id: I am trying to find a reasonable workaround to a problem involving representation clauses and tagged records. I believe I am running into problems with freezing rules. Below are two compiler listings which are very similar. When the record type is visible, the compiler is happy. When the record type is private, it complains. The question in my mind is *WHY* is there some sort of restriction on this? What compiler mission cannot be achieved unless the record is visible? Is there some sort of workaround that would enable representation clauses on private tagged records? (Inheritance from a rep-claused-tagged-record is its own problem!) GNAT 3.12p (19990629) Copyright 1992-1999 Free Software Foundation, Inc. Compiling: rep_clause_01.ads (source file time stamp: 2000-07-17 14:20:14) 1. with System ; 2. 3. package Rep_Clause_01 is 4. 5. type UInteger_16 is mod 2**16 ; 6. for UInteger_16'Size use 16 ; 7. 8. type Rec_Type is tagged record 9. Field_01 : Uinteger_16 := 0 ; 10. Field_02 : Uinteger_16 := 0 ; 11. Field_03 : Uinteger_16 := 0 ; 12. end record ; 13. 14. private 15. 16. for Rec_Type use record 17. Field_01 at 4 range 0..15 ; 18. Field_02 at 6 range 0..15 ; 19. Field_03 at 8 range 0..15 ; 20. end record ; 21. 22. for Rec_Type'Size use 10 * System.Storage_Unit ; 23. for Rec_Type'Alignment use 2 ; 24. 25. end Rep_Clause_01 ; 25 lines: No errors GNAT 3.12p (19990629) Copyright 1992-1999 Free Software Foundation, Inc. Compiling: rep_clause_02.ads (source file time stamp: 2000-07-17 14:20:14) 1. 2. with System ; 3. 4. package Rep_Clause_02 is 5. 6. type UInteger_16 is mod 2**16 ; 7. for UInteger_16'Size use 16 ; 8. 9. type Rec_Type is tagged private ; 10. 11. private 12. 13. type Rec_Type is tagged record 14. Field_01 : Uinteger_16 := 0 ; 15. Field_02 : Uinteger_16 := 0 ; 16. Field_03 : Uinteger_16 := 0 ; 17. end record ; 18. 19. for Rec_Type use record 20. Field_01 at 4 range 0..15 ; 21. Field_02 at 6 range 0..15 ; 22. Field_03 at 8 range 0..15 ; 23. end record ; 24. 25. for Rec_Type'Size use 10 * System.Storage_Unit ; | >>> size for "Rec_Type" too small, minimum allowed is 128 26. for Rec_Type'Alignment use 2 ; | >>> alignment for "Rec_Type" must be at least 4 27. 28. end Rep_Clause_02 ; MDC -- ====================================================================== Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/ Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m Visit my web site at: http://www.mcondic.com/ "Nothing in the world is more dangerous than sincere ignorance and conscientious stupidity." -- Martin Luther King, Jr ======================================================================