lua-users home
lua-l archive

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


Klaus Ripke wrote:
On Wed, Sep 19, 2007 at 03:02:07PM -0400, Ralph Hempel wrote:
What are Lua's expected semantics of:
what makes you assume that Lua expects anything other than:

1. realloc() an existing block to a size of 0 bytes?
http://www.opengroup.org/onlinepubs/007908775/xsh/realloc.html :
"If size is 0 and ptr is not a null pointer, the object pointed to is freed."
In plain english: the expected semantics is a call to free.
A null pointer save free, kinda.

2. realloc() a new block to a size of 0 bytes?
"If ptr is a null pointer, realloc() behaves like malloc() for the specified size."

read on http://www.opengroup.org/onlinepubs/007908775/xsh/malloc.html :
"If the size of the space requested is 0, the behaviour is implementation-dependent; the value returned will be either a null pointer or a unique pointer."

Just like Roberto said.

What's the issue?

There's no issue. I have a Lua interpreter implemented on a the LEGO
MINDSTORMS NXT, which is a non-POSIX platform and it's crashing
occasionally.

I just want to be sure I'm covering everything.

Ralph