Hacker News new | ask | show | jobs
by compiler-guy 1827 days ago
And only works if you don't rely on any third-party libraries that take normal C strings.

Which is to say, is unrealistic for many programs.

3 comments

Depends on much they value security, even std::string has an extra null for c_str() calls.
Send the pointer from the pair to 3rd party and not the pair itself. You lose the efficiency in 3rd party, but still retain your gain in your own code. Better than before.
You can use a library that also adds a trailing \O. I used it to interface C++.