From: aschwarz@acm.org (skidmarks)
Subject: Ada Pointer Size Problem
Date: 10 Oct 2004 12:50:43 -0700
Date: 2004-10-10T12:50:43-07:00 [thread overview]
Message-ID: <35f054ea.0410101150.25bec2f5@posting.google.com> (raw)
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
>>
next reply other threads:[~2004-10-10 19:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-10 19:50 skidmarks [this message]
2004-10-11 1:38 ` Ada Pointer Size Problem Stephen Leake
2004-10-12 18:44 ` skidmarks
2004-10-13 1:23 ` Jeffrey Carter
2004-10-13 8:07 ` Martin Krischik
2004-10-13 16:27 ` Jean-Pierre Rosen
2004-10-11 5:18 ` Jeffrey Carter
2004-10-21 1:16 ` Dave Thompson
2004-10-21 1:56 ` Jeffrey Carter
2004-10-21 9:54 ` Martin Krischik
2004-10-22 1:09 ` Jeffrey Carter
2004-10-22 7:48 ` Martin Krischik
2004-10-22 9:41 ` Adrien Plisson
2004-10-22 16:50 ` Warren W. Gay VE3WWG
2004-10-24 16:05 ` Martin Krischik
2004-10-23 1:35 ` Jeffrey Carter
2004-10-24 15:52 ` Martin Krischik
2004-10-22 5:41 ` Simon Wright
2004-10-22 18:05 ` Mark Lorenzen
2004-11-01 8:14 ` Dave Thompson
2004-10-11 8:45 ` Martin Krischik
[not found] ` <1c2f5137.0410130505.57e03c@posting.google.com>
2004-10-13 13:37 ` Dmitry A. Kazakov
2004-10-14 3:46 ` Steve
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox