alx-0029r4 - Restore the traditional realloc(3) specification
Alejandro Colomar
alx@kernel.org
Wed Jun 25 17:35:58 GMT 2025
Hi Eric,
On Wed, Jun 25, 2025 at 03:16:06PM +0200, Alejandro Colomar wrote:
> > > @@ New footnote XXX
> > > +XXX)
> > > +While atypical,
> > > +<b>realloc</b> may fail
> > > +for a call that shrinks the block of memory.
> >
> > Is it worth wording this as "may fail or return a different pointer
> > for a call that shrinks the block of memory"?
>
> Yeah, we can add that.
I've changed my mind; the current wording of ISO C makes it that all
realloc(3) successful return values are new pointers, and it doesn't
seem to mention that the old pointer could be kept (I remember having
seen such text in older standards, I think; or maybe in POSIX), so let's
keep in that sense, and assume that realloc(3) always moves the memory,
even if sometimes it doesn't, as that is not observable by a conforming
program.
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/20250625/7bc043ed/attachment.sig>
More information about the Libc-alpha
mailing list