Hacker News new | ask | show | jobs
by imron 1465 days ago
Perhaps, but in the in the ancient past before STL was standardized, Chrome didn't exist.

10 years ago (when the parent mentioned they were still at Google) c++11 was already out.

3 comments

While it's true that the Standard Template Library is truly a "long time" ago, being a 1990s project, the poster's phrase "before STL was standardized" actually refers to C++ 98 and C++ 03 where the C++ standards don't specify std::string internals.

Originally C++ doesn't have a string type, the C++ 98 standard does standardize a string type but it's only loosely specified. Most implementations do something "clever" which it turns out is a bad idea (this is a recurring theme in C++. Only in C++ 11 does the standard say OK, we'll prescribe how the string class actually works, making it more complicated but hopefully avoiding the worst problems.

Chrome was launched in 2008, and much of its internal structure was far older having incorporated work by Mozilla and Apple.

> work by Mozilla and Apple

Don’t forget the origin of WebKit, KHTML from the KDE folks.

Ten years ago was 2012. C++11 came out in 2011. Do you believe a big codebase like Chrome would be converted to C++11 less than one year after the spec was published? I find that unlikely but i never worked on such a big codebase so i wouldn't know.
The STL was mostly standardised in C++98, 1998. There were additions in C++03 and C++11, but nothing like removing this type of overload.

Long running systems were still using pre-standardisation libraries for string up to 2012 however, so you may well have come across such projects.

> nothing like removing this type of overload.

Bzzt. C++ 11 completely overhauls how std::string is defined.

> C++11 came out in 2011

C++0x was a thing, with varying levels of support from all major compilers, for years before C++11 was finally ratified.

In the context of my original comment though, no matter how dated the code base, I think it unlikely that Chrome was using any variant of std::string that had an implicit conversion operator for const char* such that string could be passed as a parameter to a function taking const char* without needing to call c_str().

Ja, they have no excuse. They mostly just don't care. And why should they? Google cares nothing for them.