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

I may be using incorrect terminology, or at least I think you are presuming a more object oriented interpretation. I don't recall the exact circumstance, but it was a case where one would normally call calloc() rather than malloc() once for a buffer. This proposal to switch to calloc() was rejected due to expense of calling bzero(). I think I proposed making it a array with an initializer rather than a pointer, taking a couple KB size penalty in return for quieting a warning and removing some code smell.

The code wasn't merely copying an uninitialized variable, it was branching on the random data that happened to be in the data returned by malloc(). This confused Valgrind, but was thought to be safe due to some later check. To me this was fragile code and unsafe practice. To the decision makers, it was a good way to save a couple cycles and a few bytes. The culture (at least at the time) felt that efficiency trumped clarity and maintainability. This is a blessing and a curse.



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

Search: