Talk:POSIX Error Handling
A couple of questions/comments:
- Would the preservation of errno fit better inside the if block? I don't think the test for "evidence of error" could change errno, and it might be good to localize the scope of the saved errno variable ("errorNumber").
- I'm not sure why you are using strerror_r rather than strerror. Since strerror returns a pointer to static data that will not move, there are no multi-threading or lifetime issues to consider. This would simplify the code a good deal, and strerror could be called inside the argument list of printf.
--Neil 23:47, 11 June 2008 (MDT)