BUG: realloc(p,0) should be consistent with malloc(0)
Alejandro Colomar
alx@kernel.org
Wed Jun 18 18:05:34 GMT 2025
Hi Andreas,
On Wed, Jun 18, 2025 at 05:42:40PM +0200, Andreas Schwab wrote:
> On Jun 17 2025, Alejandro Colomar wrote:
>
> > RETURN VALUE
> >
> > If size is 0,
> > ...
> > either:
> >
> > - A null pointer shall be returned
> > and, if ptr is not a null pointer,
> > errno shall be set to EINVAL.
> >
> > - A pointer to the allocated space shall be returned,
> > and the memory object pointed to by ptr shall be freed.
> > ...
> >
>
> Note that all of this is marked obsolescent.
Note that it's marked obsolescent because ISO C has turned this into UB.
If ISO C defines the behavior again, then the obsolescence of this could
be reverted.
Have a lovely day!
Alex
--
<https://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250618/973c27e9/attachment-0001.sig>
More information about the Libc-alpha
mailing list