Talk:VList: Difference between revisions

no edit summary
(→‎Some problems: persistent)
No edit summary
Line 26:
::And... without this issue, these performance characteristics can be achieved with regular arrays (or, for a language like C: a structure which consists of a pointer to an array, the currently used array length and the currently allocated array length -- when you need more space, use realloc to double the allocated space -- and subtract the index you are using from the length of the array to achieve the "add to front" semantics of the VList). This flat array approach results in a simpler algorithm and significantly lower constant factors when reading the data. --[[User:Rdm|Rdm]] 15:01, 13 September 2011 (UTC)
::: Sure, but VList is meant to give persistent pointers. Realloc may move buffer and invalidate all pointers into its elements, while VList would not. --[[User:Ledrug|Ledrug]] 15:31, 13 September 2011 (UTC)
:::: But none of the task requirements mention pointers. And "persistent pointers" are a language-specific construct, as are "pointers". Also the advantages of pointers into an array over array indices are obscure, or negative, especially in the context of languages which implement some form of memory management. --[[User:Rdm|Rdm]] 15:40, 13 September 2011 (UTC)
6,962

edits