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 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 -
-
-
@RichFelker stdlib functions don't need to be optimal for all input distributions. They can't be. They need to be robust and not-terrible. -
@RichFelker `strstr( )` is basically terrible by definition. I would not shed any tears for it.
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.