Re:Why is Rust slightly slower than C?
by ncmncm on Thursday September 12, 2019 @07:02AM
(#20950086)
If your constructor news memory, then if you don't write a destructor, then nothing deletes the memory. You don't need to "opt out". It is hard to guess where you get this idea.
It is bad form to code memory leaks, so normally one doesn't. Instead, one normally allocates in such a way that the automatically-generated destructor frees the memory.
But neither case requires writing more code to "opt in" or to "opt out". It is the same in Rust.
It is bad form to code memory leaks, so normally one doesn't. Instead, one normally allocates in such a way that the automatically-generated destructor frees the memory.
But neither case requires writing more code to "opt in" or to "opt out". It is the same in Rust.