3 ms·
One issue with the str..._s() functions is that the invalid-parameter handler is a global setting - all code that calls the slibc functions and hits an invalid
by hyperrail 12y ago
One issue with the str..._s() functions is that the invalid-parameter handler is a global setting - all code that calls the slibc functions and hits an invalid parameter problem will call the handler. This could cause anything from your application code to some random library you never heard of to make your program abort().
I personally don't think this is a big problem, as the kinds of issues that would cause the invalid parameter handler to be called usually are not recoverable no matter where they originate from.
But I can definitely see why the loss of control is technically troubling - those random libraries could be calling set_constraint_handler_s() and thus causing your code to keep running and not abort(), forcing you to rely on your second defense of checking the return values from all the functions.
(There's also a potential political issue with str..._s(), but I won't go into that one.)