by slavik81 · 5y ago · 0 comments
> Lazy programmers would do this, and have slow programs
char* str = "*Hello!";
str[0] = strlen(str) - 1;
Modern compilers understand strlen, and will replace the function call with a constant where possible. That code's not slow anymore: https://godbolt.org/z/Kjh8b44KfBut Joel was talking about C rather than C++, where your comments about std::string wouldn't apply, right?