3 ms·
Then you can't eat it too (or else you'll get very sick with NPEs/panics), sorry.
by the_gipsy 2y ago
Then you can't eat it too (or else you'll get very sick with NPEs/panics), sorry.
- whytevuhuni 2y agoMore specifically, it could result in undefined behavior, if a panic happens between the allocation and initialization (i.e., it was allocated, not initialized, panicked, and something observed the incomplete struct after the panic). Alternatively, the allocation would always have to leak on panic, or the struct would have to be deallocated without a destructor running.