[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: out of memory
- From: Björn De Meyer <bjorn.demeyer@...>
- Date: Sat, 05 Oct 2002 23:34:07 +0200
Edgar Toernig wrote:
> That's what my man page says too. But on Linux the man pages
> regarding libc are 2nd class citizens. They are collected
> from various places (posix, ansi, *bsd, ...) and sometime do
> not reflect actual behaviour.
> The libc info pages are the real documentation and there's
> nothing about realloc(x,0) freeing objects (it even warns
> that realloc(0,s) does not work on all systems).
> Ciao, ET.
So, the conclusion is that the Linux manpages for realloc()
are faulty. The ANSI C standard which Edgar quoted is clear
enough. Using realloc(x,0) causes undefined behaviour.
Therefore, IMO, it should be avoided and replaced free(),
so LUA stays on the safe side of ANSI C. It's a harsh standard,
but still, the standard.
"No one knows true heroes, for they speak not of their greatness." --
Björn De Meyer