That's not an answer. There's a reason why you can't do it in C, and the reason is "the stdlib is poorly designed". No amount of linting can get you around that.
A new modern C standard library would be a very good thing. But I am ok writing my own, tailored for my own needs and style.