Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's what sanitizers are for. Why would you do that manually given the tooling that's freely available?

When I make a logic error the absolute ideal situation is that the compiler rejects the program. The higher the frequency of that result the better.



"What I want is a compiler that slaps me when I forget to initialize a proper value, not one that quietly picks a magic value it thinks I might have meant."

I believed the claim was about whether a compiler would initialize memory to zero. Whatever I said would be done by the compiler.


I don't see how. In the presence of default initialization the compiler cannot diagnose these things, more or less by definition. Therefore you will be falling back on debugging.

UB plus a memory access sanitizer automates the practice that you described.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: