lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> The main benefit of using variable-length arrays is allocating on the
> stack, which can also be done with alloca() -- both avenues not
> possible with C89.  Going the route of luaL_Buffer would still
> allocate on the heap (internally using Lua's set allocator function --
> which looks like realloc). [...]

luaL_Buffer only allocates on the heap after a certain size limit
(typically 8 KB). Otherwise it uses the stack.

-- Roberto