Re:Std::string half of all allocations in the Chrome browser...
by csl on Friday December 05, 2014 @09:35AM
(#8704673)
It always depends on your needs.
Before you start avoiding std::string, note that the article said that one of the problems was that they went from std::string to C-strings and then allocated a new std::string. This often happens when you use both kind of strings in your code. The takeaway is to stick either to C strings or use std::strings with reference passing, dropping down to c_str() when needed.
Re:Std::string half of all allocations in the Chrome browser...
by vegancap on Friday December 05, 2014 @01:00PM
(#8705814)
Thanks, that was a lot more helpful response :) I think the most confused I've been so far (coming from a PHP background) was all the different types of strings!
Before you start avoiding std::string, note that the article said that one of the problems was that they went from std::string to C-strings and then allocated a new std::string. This often happens when you use both kind of strings in your code. The takeaway is to stick either to C strings or use std::strings with reference passing, dropping down to c_str() when needed.