A look at a legacy C++ codebase where developers migrating away from C-style strings in 2007 still used C string functions (strncmp, strlen, c_str()) unnecessarily. The code performs a 'starts with' check using strncmp on std::string objects converted back to C-strings, when a cleaner C++ approach using std::string::find() was already available. The C++20 starts_with() method would be the modern solution, but even in 2007 the find() approach was far more readable.
Sort: