comp.lang.ada
 help / color / mirror / Atom feed
* Are unconstrained arrays passed by references?
@ 1999-08-10  0:00 bourguet
  1999-08-10  0:00 ` Robert A Duff
  0 siblings, 1 reply; 9+ messages in thread
From: bourguet @ 1999-08-10  0:00 UTC (permalink / raw)


In the Intermetric X bindings, there is something like this in
X.Strings (this is from memory, I may mess up the details but
the principle should be clear):

subtype char is Interfaces.C.char;
type charp is access all char;

function Addr (S : String) return charp;

function To_X (A : System.Address) return charp is
   new Unchecked_Conversion...

function Addr (S : String) return charp is
begin
   return To_X (S (S'First)'Address);
end Addr;

There is a warning to use Addr only with variables and constants
because if the argument was an expression the result may be
dangling before it was of any use.

I understand how this work if the string is passed by reference,
and why passing unconstrained array by reference make sense,
but as I've not found in the RM indications that it is mandatory
I was wondering if I've missed something or if this code rely on
a probable implementation.

Thanks.

-- Jean-Marc


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




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

end of thread, other threads:[~1999-08-11  0:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-10  0:00 Are unconstrained arrays passed by references? bourguet
1999-08-10  0:00 ` Robert A Duff
1999-08-10  0:00   ` bourguet
1999-08-10  0:00     ` Tucker Taft
1999-08-10  0:00       ` Robert Dewar
1999-08-11  0:00         ` Larry Kilgallen
1999-08-10  0:00     ` Ted Dennison
1999-08-11  0:00     ` Robert A Duff
1999-08-11  0:00       ` Robert Dewar

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