comp.lang.ada
 help / color / mirror / Atom feed
From: Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>
Subject: How do functions return unbounded arrays?
Date: 1998/06/14
Date: 1998-06-14T00:00:00+00:00	[thread overview]
Message-ID: <358444BA.757121D8@cl.cam.ac.uk> (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/>




             reply	other threads:[~1998-06-14  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-14  0:00 Markus Kuhn [this message]
1998-06-14  0:00 ` How do functions return unbounded arrays? Robert A Duff
1998-06-15  0:00 ` John Herro
1998-06-17  0:00   ` Mark D. McKinney
1998-06-17  0:00   ` Matthew Heaney
     [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-21  0:00   ` Robert Dewar
replies disabled

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