From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_20 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 2 Jul 91 17:09:02 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!petunia!nwebre@ucbvax.Be rkeley.EDU (Neil Webre) Subject: Re: What should this do? Message-ID: <2870b32e.58b0@polyslo.CalPoly.EDU> List-Id: You might use the following program to get a glimpse of what your Ada system is doing with mutable records. It's not completely definitive but gives a good clue. Sorry for the global variables - this is one off quick and dirty. PS to Mike Feldman - Re your question on what Alsys does in this case. This was run on Alsys Ada on AIX/370, IBM 3090/400. It appears that they allocate maximum space (20 bytes) and have the string bob about in it. Good for speed, bad for space utilization -- Check Alsys techniques for mutable records. with text_io; use text_io; with system; -- Alsys version has a procedure "image" that makes -- addresses into strings. procedure main is subtype index is integer range 0..20; type rec(len : index := 0) is record data : string(1..len); end record; S : rec; procedure print is begin put_line("S's address is " & system.image(S'address) & " hex"); put_line("For S.len =" & integer'image(S.len) & ',' & integer'image(S'size/8) & " bytes are used."); new_line; end print; begin S := (0, ""); print; S := (10,"0123456789"); print; S := (20,"01234567890123456789"); print; S := (0,""); print; end main; Results of execution: S's address is 0024BAFC hex For S.len = 0, 7 bytes are used. S's address is 0024BAFC hex For S.len = 10, 17 bytes are used. S's address is 0024BAFC hex For S.len = 20, 27 bytes are used. S's address is 0024BAFC hex For S.len = 0, 7 bytes are used. Neil Webre Cal Poly, San Luis Obispo, CA Department of Computer Science.