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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,61006929d3e14455,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews1.google.com!not-for-mail From: aschwarz@acm.org (skidmarks) Newsgroups: comp.lang.ada Subject: Ada Pointer Size Problem Date: 10 Oct 2004 12:50:43 -0700 Organization: http://groups.google.com Message-ID: <35f054ea.0410101150.25bec2f5@posting.google.com> NNTP-Posting-Host: 12.72.61.136 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1097437844 4161 127.0.0.1 (10 Oct 2004 19:50:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 10 Oct 2004 19:50:44 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:5010 Date: 2004-10-10T12:50:43-07:00 List-Id: I have a problem with the test program below. Perhaps someone can help me. 1. P1_Size gives an error. P2_Size and P3_Size don't. I would have expected errors everywhere or nowhere. I don't understand what is 'non-static' about the expression since a typedef is invariant. 2. 'thang' (L13) is erroneous but 'Variable' (L17) is not. I suspect that this means that the non-static nature of the expression is OK as a statement but not in a definition. 3. The string pointer size (eliding the error statements) is 64-bits. I am using an AMD 2100 (32-bit) computer and gcc-3.3.3-3. I would have expected a 32-bit pointer. 4. The integer pointer size (eliding the error statements) is 32-bits. I would have expected that it would be the same size as the string pointer. I've looked at the 'info' tex file included with the gcc distribution and so far have not found how to change a 64-bit pointer to a 32-bit pointer. I've thought that maybe I am getting the dope vector size associated with the String_Ptr but this really doesn't make sense. The Integer_Ptr is only 32-bits which seems to be correct but both pointers should be the same. Any idea of what I'm really missing? art -------------------------------------------------------- # compiling under Cygwin on a Windows 2000, AMD 2100 CPU # gcc-3.3.3-3 >> gcc -c -gnatfv -gnatl junk.adb GNAT 3.3.3 (cygwin special) Copyright 1992-2002 Free Software Foundation, Inc. Compiling: junk.adb (source file time stamp: 2004-10-10 19:50:18) 1. with Text_IO; use Text_IO; 2. 3. procedure junk is 4. type String_Ptr is access all String; 5. type Integer_Ptr is access all Integer; 6. 7. In_Size : constant := Integer'Size; 8. Fl_Size : constant := Float'Size; 9. P1_Size : constant := String_Ptr'Size; | >>> non-static expression used in number declaration 10. P2_Size : Integer := String_Ptr'Size; 11. P3_Size : constant Integer := String_Ptr'Size; 12. thing : constant := Integer'Max(In_Size, Fl_Size); 13. thang : constant := Integer'Max(thing, P2_Size); | >>> non-static expression used in number declaration 14. Variable : Integer; 15. 16. begin -- junk 17. Variable := Integer'Max(In_size, String_Ptr'Size); 18. Put_Line("Integer = " & Integer'Image(Integer'Size) ); -- 32 bits 19. Put_Line("Float = " & Integer'Image(Float'Size) ); -- 32 bits 20. Put_Line("Int_Ptr = " & Integer'Image(Integer_Ptr'Size)); -- 32 bits 21. Put_Line("Ptr = " & Integer'Image(String_Ptr'Size)); -- 64 bits 22. Put_Line("Ptr1 = " & Integer'Image(P1_Size)); -- 64 bits 23. Put_Line("Ptr2 = " & Integer'Image(P2_Size)); -- 64 bits 24. Put_Line("Ptr3 = " & Integer'Image(P3_Size)); -- 64 bits 25. Put_Line("Variable= " & Integer'Image(Variable)); -- 64 bits 26. end junk; 26 lines: 2 errors >>