3 ms·
Depends on how the array is created. If it comes from "malloc" or C++ "new", it may need to be created as a "Vec".
by Animats 2y ago
Depends on how the array is created. If it comes from "malloc" or C++ "new", it may need to be created as a "Vec".
- tialaramex 2y agoFirstly, that's not an array. C has actual arrays, even though they decay to pointers at API edges and what you've made with malloc is not an array. I'll disregard C++ new and new[] But also, it's definitely not a growable array. Box::new_uninit_slice makes the thing you've got here, a heap allocation of some specific size, which doesn't magically grow (or shrink) and isn't initialized yet.