Passing dynamic arrays
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Fri Nov 26 14:21:36 PST 2010
On 26/11/2010 22:12, spir wrote:
> On Fri, 26 Nov 2010 21:59:37 +0000
> Bruno Medeiros<brunodomedeiros+spam at com.gmail> wrote:
>
>> You could still do exponential capacity growth by manipulating the
>> length property, but yeah, that would create a host of complexity and
>> other issues (see my reply to Pelle). Yeah, my reasoning was really
>> broken. :'(
>
> What is the reason why D does not internally manages exp growth with a (private) capacity field? It's very common, and I thought the reason was precisely efficiency as it does not require reallocating so often, esp in cases such as feeding an array in a loop like in Andrei's example.)
>
>
> Denis
> -- -- -- -- -- -- --
> vit esse estrany ☣
>
> spir.wikidot.com
>
But D does exactly that, there is a capacity field (internal to the GC),
and array growth is managed automatically, in an exponential way.
--
Bruno Medeiros - Software Engineer
More information about the Digitalmars-d
mailing list