2 ms·
On efficiency The compiler cannot rely on the stack (or registers) to be zero, so there has to be a instruction to set it to zero anyways. However, setting a
by qznc 11y ago
On efficiency
The compiler cannot rely on the stack (or registers) to be zero, so there has to be a instruction to set it to zero anyways.
However, setting a register to zero is a special case and your hardware might be optimized for it.
https://randomascii.wordpress.com/2012/12/29/the-surprising-subtleties-of-zeroing-a-register/ https://randomascii.wordpress.com/2012/12/29/the-surprising-...
Maybe setting to zero would faster. However, if you optimize on that level, then you can optimize by hand as well. Set it to zero explicitly or even let it uninitialized explicitly:
int x = void;