joe@petsd.UUCP (07/22/86)
Since it was pointed out to me that my original program posted raised
PROGRAM_ERROR when executed, I re-wrote it. The idea is to find out how
various compilers implement unconstrained records with an array component
dependent on the discriminant. Please compile this program with your Ada
compiler and let me know how the record objects are implemented (and how
much space they occupy). I will summarize to the net.
----------------------------------------------------------------------
package unc_pkg is
type var_string(length : integer) is record
component : string(1..length);
end record;
a : var_string(11) := (11, "Hello world");
function b return var_string;
end unc_pkg;
package body unc_pkg is
function b return var_string is
begin
return a;
end b;
end unc_pkg;
with unc_pkg, text_io;
use unc_pkg, text_io;
pragma elaborate(unc_pkg);
procedure unc is
c : constant var_string := b;
begin
put_line("Start unconstrained record test");
put_line(c.component);
put_line("Stop test");
end unc;
----------------------------------------------------------------------
regards,
joe
--
Full-Name: Joseph M. Orost
UUCP: ihnp4!vax135!petsd!joe
ARPA: vax135!petsd!joe@BERKELEY
Phone: (201) 758-7284
Location: 40 19'49" N / 74 04'37" W
US Mail: MS 313; Concurrent Computer Corporation; 106 Apple St
Tinton Falls, NJ 07724