3 ms·
Yeah I wouldn't call that working on MSVC either haha.
by dataflow 3y ago
Yeah I wouldn't call that working on MSVC either haha.
- gavinsyancey 3y agoDefinitely not "working", yeah, but On MSVC, an all-zero string object is the correct representation for a std::string containing "" (and the memory leak is easy to miss if you don't do it too much). On both Clang and gcc, an all-zero string object is not using the short-string optimization -- it is a string with size zero, capacity zero, and an external buffer of nullptr. (On clang this happens because capacity is even, and on gcc because &str->buf != &str). Any code that attempts to access its null terminator will dereference the null pointer and crash immediately.
- dataflow 3y agoYeah I get that.