2 ms·
> With that in mind, isn't it the user's job to know the size of the buffers he's using? Yes. The user knows the size of his buffer, and then passes that know
by clarry 7y ago
> With that in mind, isn't it the user's job to know the size of the buffers he's using?
Yes. The user knows the size of his buffer, and then passes that knowledge on to the string constructing functions so that they do not overflow the buffer.
> Doesn't expecting that the function know about buffer size go against the single responsibility principle?
What's single responsibility again? "Execute this one assembly instruction"?
What you want from standard library functions is, usually, "construct a string into this buffer (whose size is N)."