Commit | Line | Data |
---|---|---|
28e7fd62 | 1 | -- Copyright 2008-2013 Free Software Foundation, Inc. |
a4d0b9c3 JB |
2 | -- |
3 | -- This program is free software; you can redistribute it and/or modify | |
4 | -- it under the terms of the GNU General Public License as published by | |
5 | -- the Free Software Foundation; either version 3 of the License, or | |
6 | -- (at your option) any later version. | |
7 | -- | |
8 | -- This program is distributed in the hope that it will be useful, | |
9 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | -- GNU General Public License for more details. | |
12 | -- | |
13 | -- You should have received a copy of the GNU General Public License | |
14 | -- along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | with Pck; use Pck; | |
17 | ||
18 | procedure Foo is | |
19 | type String_Access is access String; | |
20 | ||
21 | String_P : String_Access := new String'("Hello"); | |
9e87a409 | 22 | Null_String : String_Access := null; |
af57139d JB |
23 | |
24 | -- Same situation, but constrained array. | |
25 | type Little_Array is array (1 .. 10) of Integer; | |
26 | type Little_Array_Ptr is access all Little_Array; | |
27 | Arr_Ptr: Little_Array_Ptr := | |
28 | new Little_Array'(21, 22, 23, 24, 25, 26, 27, 28, 29, 30); | |
51b86426 JB |
29 | |
30 | -- Same as above, but with a packed array. | |
31 | type Small is range -64 .. 63; | |
32 | for Small'Size use 7; | |
33 | type Packed_Array is array (1..10) of Small; | |
34 | pragma Pack (Packed_Array); | |
35 | ||
36 | type Packed_Array_Ptr is access Packed_Array; | |
37 | PA_Ptr : Packed_Array_Ptr | |
38 | := new Packed_Array'(10, 20, 30, 40, 50, 60, 62, 63, -23, 42); | |
a4d0b9c3 JB |
39 | begin |
40 | Do_Nothing (String_P'Address); -- STOP | |
9e87a409 | 41 | Do_Nothing (Null_String'Address); |
af57139d | 42 | Do_Nothing (Arr_Ptr'Address); |
51b86426 | 43 | Do_Nothing (PA_Ptr'Address); |
a4d0b9c3 | 44 | end Foo; |