Hacker News new | past | comments | ask | show | jobs | submit login

Still confused.

What is a user in your reply? I mean, an end user / my mom isn't going to call strtonum? Some developer does. And said developer can absolutely ignore the string's content?

Test for success: errno is 0, errstrp is NULL Handle error: Use errno or errstrp - the latter gives you a bit more information (reports a different error for invalid ranges, too small vs. too large).

But if you don't care, errno is fine, no? And we're still talking about the programmer here, as far as I'm concerned.

Ted has a description of his intentions here [1]. I guess I'm confused why there's a fuzz about it, because technically this method should be good enough? I do have to shake my head at the "Even if intmax_t probably would have been a better choice, I think we’re sticking with long long just because it frustrates people unwilling to admit it doesn’t make a difference." remark, but .. other than that? Does it .. matter?

1: http://www.tedunangst.com/flak/post/the-design-of-strtonum




Yes, the user is the person who runs the program that they didn't write. They don't know that they called strtonum()

testing for errno == 0 is not actually useful, since errno is not set except on error (that is by design of errno, it is always an indication of what the last error was, not that there was an error)

and errstrp doesn't give the Klingon user you mentioned any information at all, since they can't read English.

fafner said it better than I in https://news.ycombinator.com/item?id=9184734

and yes it does matter, for a standard libc function, because if you don't take care about setting standards, then your standards will be a mess.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: