On Tue, Jun 23, 2009 at 7:43 PM, john
skaller<skal...@users.sourceforge.net> wrote:
>
> using += grows the used size, up to the allocated maximum.
> After that I think C++ implementation throws an exception.
>
> To make one that grows like C++ vector, use something like:
>
> typedef rvarray = &varray;
>
> or a more OO version of this:
>
> typedef rvarray = & &varray;
>
> and then reallocate the varray when it gets full.

This would be a nice feature to have, since resizable arrays are so useful.

> Ideally, on platforms like Linux, we'd use mmap() instead of malloc,
> and then extending a rvarray would not require copying anything
> (just change the address of the existing pages). However the implementation
> is a bit hairy and platform dependent.

I've never done much with mmap, but I do know that llvm has cross
platform bindings to the various mmap implementations. Since they're
BSD too, it might be worthwhile looking at how they do it, and
possibly using their code too instead of maintaining our own platform
independent bindings.

------------------------------------------------------------------------------
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to