[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: C coding practice for top of stack
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 22 Feb 2013 08:40:17 -0300
> Two related queries.
> 1. If you fail to checkstack and the function's error handling is
> classified as '-', this may cause low-level errors (segmentation
> etc) not caught by Lua, right?
Yes. That is life in C...
> 2. I've written a vararg function which builds up a lot of stuff
> on top of the vararg, but the vararg itself is not returned.
> There seems not to be a cheap API function for removing
> contiguous buried items, you have to do it one at a time.
> That's O(n^2) if the number 'n' of items to remove is the
> same the depth to which they are buried. Is it in any way
> perilous just to leave them there?
Not at all. It is expected. (The 'int' return in lua_Cfunction exists
only to allow this.)