comp.lang.ada
 help / color / mirror / Atom feed
* Re: unconstrained arrays in records
@ 1986-07-22 14:52 joe
  0 siblings, 0 replies; only message in thread
From: joe @ 1986-07-22 14:52 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1986-07-22 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-07-22 14:52 unconstrained arrays in records joe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox