comp.lang.ada
 help / color / mirror / Atom feed
* How do functions return unbounded arrays?
@ 1998-06-14  0:00 Markus Kuhn
  1998-06-14  0:00 ` Robert A Duff
  1998-06-15  0:00 ` John Herro
  0 siblings, 2 replies; 15+ messages in thread
From: Markus Kuhn @ 1998-06-14  0:00 UTC (permalink / raw)



One of the things that still puzzles me about Ada is: how do
compilers implement functions such as "&" that return variable
length strings or arrays.

To get such a functionality under C, I would have to malloc() the
memory for a String in the C function and then I am left with
the question of when to free this memory. Does an Ada function
such as "&" (concatenation of arrays) allocate secretly memory
on the heap to get a space to store the result?

If yes, when exactly is this memory deallocated? Are there Ada
programs that cause a heap overflow just by calling "&" in a long loop
and where this danger of a heap overflow is not explicit in the
program text as no allocator is visible? In other words, are there
any safety (heap overflow) risks associated with functions like "&"?

Is there a good paper that describes those things that silently
go on between the lines of an Ada program and that still keep me
from getting the warm fuzzy C programmer feeling that I really
know what exactly is going on when my code executes?

Also, is there any documentation around that describes the interface
that GNAT expects from the run-time library, i.e. whatever one
would need in order to write a new GNAT runtime library with all
the tasking, memory management, etc. (Again, just to get the feeling
that I know what is going on behind the scenes.)

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




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

end of thread, other threads:[~1998-06-21  0:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-14  0:00 How do functions return unbounded arrays? Markus Kuhn
1998-06-14  0:00 ` Robert A Duff
1998-06-15  0:00 ` John Herro
1998-06-17  0:00   ` Mark D. McKinney
     [not found]   ` <35865075.9D7DCBD@cl.cam.ac.uk>
1998-06-17  0:00     ` Gavin Finnie
1998-06-17  0:00       ` Rod Chapman
1998-06-21  0:00         ` Robert Dewar
1998-06-21  0:00         ` Robert Dewar
1998-06-21  0:00       ` Robert Dewar
1998-06-17  0:00     ` Matthew Heaney
1998-06-21  0:00       ` Robert Dewar
1998-06-18  0:00     ` Mats Weber
1998-06-21  0:00       ` Robert Dewar
1998-06-17  0:00   ` Matthew Heaney
1998-06-21  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