[musl] Re: realloci(): A realloc() variant that works in-place

Thiago Macieira thiago@macieira.org
Fri Oct 31 19:15:51 GMT 2025


On Friday, 31 October 2025 11:12:10 Pacific Daylight Time Paul E. McKenney 
wrote:
> In C++, presumably, only std::movable types should be passed to realloc(),
> right?  In C, yes, this is a definitely an issue, but then again it has
> been since the advent of realloc().

Correct (wrong terminology, see below). That would be extremely useful, but is 
half of the problem. It would still be useful to apply the resize-in-place 
operation to types that cannot be realloc()ed. Like libstdc++'s std::string.


Terminology-wise, the new term is "relocatable", not "movable", because 
"movable" became used for something different in C++11 (something that had a 
move constructor or move-assignment operator). Then in the lead-up to C++26 
with paper P1144, it became "trivially relocatable": can be moved by memcpy(). 
It has since become "bitwise trivially relocatable" for reasons which do not 
bear elaborating in this discussion.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 870 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20251031/db649d31/attachment.sig>


More information about the Libc-alpha mailing list