Re:The Next Steps for Single Ownership and RAII
by Animats on Friday July 17, 2020 @02:27PM
(#23873781)
Yes, you need to be able to at least do that, for big I/O buffers and such. Those are usually raw arrays of bytes, so no problem there.
The problem I was discussing is with growable arrays, where the memory underneath is partially initialized.
Of course a language and its clever implementation can make reading unintialized values from malloc()‘d objects UB with all that implies, but that’s a spec choice.
So I believe you could define what’s returned by malloc() as safely castable to one or more “fully mapped types”, which would solve the problem for vectors at least of those types.