From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Unbounded array
Date: 1999/04/29
Date: 1999-04-29T00:00:00+00:00 [thread overview]
Message-ID: <m3g15krlw5.fsf@mheaney.ni.net> (raw)
In-Reply-To: 37262C39.D4F16DD8@wbkst21.mach.uni-karlsruhe.de
Pawel Kobylarz <kobylarz@wbkst21.mach.uni-karlsruhe.de> writes:
> Realloc function takes two parameters, the actual pointer and new
> size, and it preserves the data already present in the memory block.
> Realloc is more efficient than allocate-copy-deallocate, because it
> can add a piece of memory without moving existing data if there is
> place after the existing block.
But that isn't guaranteed. You save the cost of a copy only if there's
an adjacent block large enough to contain the new part of the array.
> In my textbook, I found only operators new and unchecked deallocation,
> nothing similar to realloc(). Is there in ADA something like
> realloc?
No, it is not built in. However, you could
1) write a binding the C function
2) write your own storage pool that supports a realloc-style operation,
and bind your access type to that pool; see RM95 13.11
There are open-source implementations of malloc, etc, so you should be
able to use the algorithm to implement an Ada95 version.
next prev parent reply other threads:[~1999-04-29 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-26 0:00 Unbounded array Pawel Kobylarz
1999-04-26 0:00 ` Robert Dewar
1999-04-27 0:00 ` Pawel Kobylarz
1999-04-28 0:00 ` Matthew Heaney
1999-04-29 0:00 ` Matthew Heaney [this message]
1999-04-29 0:00 ` dennison
1999-04-27 0:00 ` Pawel Kobylarz
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox