[musl] Re: realloci(): A realloc() variant that works in-place
Laurent Bercot
ska-dietlibc@skarnet.org
Sat Nov 1 19:27:00 GMT 2025
>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.
--
Laurent
More information about the Libc-alpha
mailing list