[musl] Re: realloci(): A realloc() variant that works in-place
Demi Marie Obenour
demiobenour@gmail.com
Sat Nov 1 20:50:28 GMT 2025
On 11/1/25 15:27, Laurent Bercot wrote:
>> Where realloci() allocates at least 'size' bytes (but possibly more),
>> and returns the actual usable size of the block.
>
> If you're set on doing something like this, it would be simpler to
> provide a function that just returns the usable size of the block,
> under which realloc() is guaranteed not to relocate the object, and
> above which it is guaranteed to relocate.
>
> This sounds like it would not work with multithreading, but neither
> would your new realloci approach that returns a supposedly usable size.
>
> All in all I don't see why C should be polluted with functions that
> are unusable by C programmers just to help optimize C++ implementations.
> This sounds like a bad trade-off, and I feel like a C++-specific issue
> should be solved in a C++-specific way.
C++ depends on C for allocation, and the same problem could also happen
in C. It's just more common in C++.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xB288B55FFF9C22C1.asc
Type: application/pgp-keys
Size: 7140 bytes
Desc: OpenPGP public key
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20251101/19fe43ad/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20251101/19fe43ad/attachment-0001.sig>
More information about the Libc-alpha
mailing list