Ushering out strlcpy()
Ushering out strlcpy()
Posted Aug 26, 2022 18:54 UTC (Fri) by wtarreau (subscriber, #51152)In reply to: Ushering out strlcpy() by NYKevin
Parent article: Ushering out strlcpy()
Here it's different, it's not a matter of relying on libc calls for other calls but rather a question of ability for a compiler to detect a well-known pattern from something that doesn't look similar. Just like we constantly have to help the C compiler catch what we're trying to do by sometimes making ugly constructs, any other language's compiler will have the same problem, and it's not necessarily trivial to match an strchr() pattern in the loop above. And that's actually part of the things I often don't like in more abstract or stricter languages, which is less freedom to tell the compiler what you're trying to do.
