comp.lang.ada
 help / color / mirror / Atom feed
From: dee%linus@MITRE-BEDFORD.ARPA (David E. Emery)
Subject: Re: Dynamic Address Clauses??
Date: 16 Jun 88 13:53:12 GMT	[thread overview]
Message-ID: <8806161353.AA17815@linus.MENET> (raw)

Here's a very legitimate use for a dynamic address clause: C often
returns addresses of objects (becaues C functions cannot return
structures).  The following should be perfectly legal AND ACCEPTABLE
(i.e.  compilers should support this):

	Ada				C 
	
	type rec is record		struct rec {
	  foo : integer;		    int foo;
	  bar : integer;		    int bar;
	end record;			};

					rec *getstuff();

	function getstuff
	    return system.address;
	pragma interface (C, getstuff);

	declare
	  myrec : rec;
	  for myrec use at getstuff;
		-- function call returns system.address.
	  fooval, barval : integer;
	begin
	  fooval := myrec.foo;
	  barval := myrec.bar;
	end;


Obviously, if address clauses were restricted to be static, this
wouldn't work.  They're not, so this should be just fine.  I've tried
this technique on Verdix/Sun, and it works just fine.

				dave emery
				emery@mitre-bedford.arpa

             reply	other threads:[~1988-06-16 13:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-06-16 13:53 David E. Emery [this message]
1988-06-17  4:13 ` Dynamic Address Clauses?? Richard A. O'Keefe
  -- strict thread matches above, loose matches on Subject: below --
1988-06-10 15:42 Jim Moody, DCA C342
1988-06-01 15:12 Mike Linnig
1988-06-02 12:39 ` Robert Firth
1988-06-10 14:38   ` stt
1988-06-15 21:19     ` Ron Guilmette
1988-06-03  6:02 ` Ron Guilmette
1988-06-03 14:52   ` markb
1988-06-06 12:33   ` David Collier-Brown
1988-06-08 18:52     ` Ron Guilmette
1988-06-10 19:22       ` Steve Hyland
1988-06-15 12:26       ` David Collier-Brown
1988-06-15 14:10 ` Burch Seymour
replies disabled

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