On 2025-03-18 17:15, Bruno Haible wrote:
If you don't want to do that, I can only repeat what I said in the previous mail: The proposal*does not achieve the goal* of avoiding the most common programmer mistakes. For a robust API, the success test should*only* involve testing the returned 'status', nothing else.
This was my initial reaction as well. Although strtol has real problems, the proposed interface is even more complicated and confusing and I suspect that in practice it'd be misused even more often than strtol is.
I suggest starting from scratch. In particular, use a functional style, with no side effects (no pointers-to-results). Just return the result you want, as a struct, and keep the struct simple. Two struct components should suffice: the scanned numeric value and a success/error indicator.