3 ms·
Rust doesn't have a new operator (its equivalent to malloc is Box). When that's used, it forces the value onto the heap- but that's not what you would write mos
by Rusky 10y ago
Rust doesn't have a new operator (its equivalent to malloc is Box). When that's used, it forces the value onto the heap- but that's not what you would write most of the time.
Local variables that are not explicitly heap-allocated (and don't have their address taken) can be on the stack or in registers, and this is true of both Rust and C/C++.