lua-users home
lua-l archive

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


Sean:

On Sun, 2 Apr 2023 at 03:06, Sean Conner <sean@conman.org> wrote:
> > Why not?
>   Because the new C23 standard is looking to make realloc(x,0) **UNDEFINED
> BEHAVIOR**!  [1] In fact, C17 apparently make realloc(x,0) as free() as
> **OBSOLESCENT**!  (really big bold upper case etc. to drive the point
> across).  Beware of using Lua with C23 it seems.

That's the link I needed. free(3) has no problem, it is void
returning, but the "If  size was equal to 0, either NULL or a pointer
suitable to be passed to free() is returned." sentence in realloc(3)
and the need to check for zero allways stopped me from some uses
except in programs where I just abort on any memory error.

FOS