Hacker News new | ask | show | jobs
by demindiro 1320 days ago
> Why is it important to initialize memory to 0's before we use it?

Because reading from unitialized memory yields an indeterminate value. Operating on such a value can lead to UB. This applies to languages other than Rust too (e.g. C).

Ralf explains it better than me[1].

[1]: https://www.ralfj.de/blog/2019/07/14/uninit.html