4 ms·
Zeros are usually less dangerous than random data - think null terminated strings, memory offsets, etc.
by IshKebab 11y ago
Zeros are usually less dangerous than random data - think null terminated strings, memory offsets, etc.
- AnimalMuppet 11y agoOr even null pointer dereferences to wake you up to the fact that you have a problem.
- zAy0LfpBZLC8mAC 11y agoWhich is all to say: It doesn't improve correctness at all. You improve correctness by making your interface difficult to use incorrectly, not by limiting the bad effects of incorrect usage. And any time your code accesses memory that is for all intents and purposes undefined (which it still is, even if you overwrite it with zeros that have no semantic intention behind them), your code is behaving incorrectly by definition.
- vardump 11y agoIt's situational. Sometimes non-zero values crash you faster.