do not overuse memset
Just a reminder. C++ is not C. memset is a useful function (you know, take-memory-location-and-length-and-fill-it-with-char). But there’s no reason whatsoever to use it in order to reset an object. Define a Reset() method (or choose your own name) and use it.
I’m not just saying it. It’s coming from a frustrated person after looking for a memory bug for day and a half. The bug was memset which reset some variable which was used in other memset and reset a lot of memory this way.
Two lessons learned:
- memset is for buffers, not for objects
- electric fence is really helpful
Technorati Tags: c++, c, memset, electric fence, efence

