I've said it before: there should only be one str* function in the standard lib: `strnlen`, and it should only be used to implement safer \
@stephentyrone There's no standard function like strstr to work with known-size strings.
-
-
@RichFelker Standard should include `memmem( )`. -
@stephentyrone Agreed, but as I mentioned memmem does not suffice to replace strstr.
End of conversation
New conversation -
-
-
@stephentyrone And even if there were, you DON'T want to compute strlen(haystack) when you expect or know needle will occur early. -
@RichFelker For an isolated call, yes. But if you don't have pervasive implicit-length strings, you already know strlen(haystack). -
@RichFelker I'm willing to accept inefficiency for a few cases to gain robustness everywhere. -
@stephentyrone Processing null-terminated strings does not hurt robustness. Only the string.h funcs that write are actually dangerous. -
@stephentyrone Everything else is a matter of style. And I don't like imposing style.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.