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

> They had discovered that you could clear a string under MSVC by `memset()`ing over it.

Why was that? Was it too problematic to just call std::string::clear ?



I'm guessing the string was part of a larger struct, and they wanted to clear the entire struct with a single memset.

It's a somewhat common pattern in C, but requires care.


> It's a somewhat common pattern in C (...)

C++ isn't C, though.




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

Search: