comp.lang.ada
 help / color / mirror / Atom feed
* passing pointer of different type to one procedure
@ 1997-04-16  0:00 Boaz
       [not found] ` <33555ECA.44A8@bix.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Boaz @ 1997-04-16  0:00 UTC (permalink / raw)



Hi there,

I am trying to write a sort procedure for a data base project.  I have 2
different records.  Instead of having 2 instances for that sort procedure,
I am thinking to use just one that take a pointer of either one of the
records type.

this is my test program but I don't quite sure how to set it up :

with text_io; use text_io;
with ada.float_text_io; use ada.float_text_io;

procedure test is


type record_pointer is access all record;  <-- error

type a is record
	key : float;
	d : integer;
end record;

type b is record
	key : float;
	e : float;
end record;

rp : record_pointer;
d1  : aliased a;
d2	: aliased b;


procedure sort(p : in record_pointer) is
begin
	put(p.key);
end sort;

begin

	d1.key := 1.0;
	d2.key := 5.0;
	rp := d1'access;
	sort(rp);
	rp := d2'access;
	sort(rp);
end test;





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1997-04-19  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-16  0:00 passing pointer of different type to one procedure Boaz
     [not found] ` <33555ECA.44A8@bix.com>
1997-04-17  0:00   ` Robert Dewar
     [not found]   ` <01bc4ad3$f3702860$6aba0c26@cat>
1997-04-17  0:00     ` Tom Moran
1997-04-17  0:00 ` John Harbaugh
1997-04-19  0:00   ` Robert Dewar
1997-04-18  0:00 ` Mark & Zurima McKinney

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