1 -- Copyright 2012-2020 Free Software Foundation, Inc.
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.
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.
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/>.
20 type Table is array (Positive range <>) of Integer;
21 type Table_Access is access Table;
23 type Object (N : Integer) is record
25 Data : Table (1 .. N);
28 My_Object : Object := (N => 3, Ptr => null, Data => (3, 5, 8));
30 -- Same as above, but with a pointer to an unconstrained packed array.
32 type Byte is range 0 .. 255;
34 type P_Table is array (Positive range <>) of Byte;
35 pragma Pack (P_Table);
36 type P_Table_Access is access P_Table;
38 type P_Object (N : Integer) is record
40 Data : P_Table (1 .. N);
43 My_P_Object : P_Object := (N => 3, Ptr => null, Data => (3, 5, 8));
46 My_Object.Ptr := new Table'(13, 21, 34); -- STOP1
47 My_P_Object.Ptr := new P_Table'(13, 21, 34);
48 Do_Nothing (My_Object'Address); -- STOP2
49 Do_Nothing (My_P_Object'Address);