[Tutor] Re: Exceptions vs error codes
kent_johnson at skillsoft.com
Fri Aug 20 13:06:17 CEST 2004
K&R second edition (the ANSI C version, published in 1988) includes
perror(), errno and strerror().
At 11:40 PM 8/19/2004 -0700, Danny Yoo wrote:
>Ah, I didn't think about that! I've always thought that perror() was
>standard; I can't imagine life without it. *grin* Let me check
>something... Here's what the man page on OS X says about perror()'s
> The perror() and strerror() functions conform to ISO/IEC 9899:1999
> (``ISO C99''). The strerror_r() function conforms to IEEE Std
> 1003.1-2001 (``POSIX.1'').
> The strerror() and perror() functions first appeared in 4.4BSD. The
> strerror_r() function was implemented in FreeBSD 4.4 by Wes Peters
> <wes at FreeBSD.org>.
>Wow. Ok, so it looks like perror() was incorporated into Standard C, so
>that's probably why it works on XP now. But you're right: not all C
>systems have had it.
> > I've used perror for years on Unix but for some reason believed it
> > wasn't part of the C library but Unix only.
> > Between curses, getch and perror I'm not having a good week! :-)
>No, no, I should be apologizing. I was wrong about the history there.
>By the way, though, it looks like the patch did get in, after all!
>Good closure on the whole episode. *grin* The next version of Python
>should give a better error message when a mistyped file is passed in.
>Martin Loewis extended the patch's behavior to account for systems without
>the strerror() function.
>Tutor maillist - Tutor at python.org
More information about the Tutor