The philosophy of errno

From: Paulo da Silva (psXdaXsilva_at_esotericaX.ptX)
Date: 02/09/05


Date: Wed, 09 Feb 2005 20:21:10 +0000

Hello:

Suppose a function that needs to return an error
condition using errno.

What is the good programming for this?

Do I need to clear errno in case of *NO* error?

Or is just enough to return some non-zero value and
set errno to the appropriate code in case of error
and return zero if no error occured don't caring about
errno in this case?

TIA
Paulo



Relevant Pages

  • Re: Implementing my own memcpy
    ... I didn't advocate using errno; ... if the caller was written by someone incompetent. ... and when a user process makes a system call, ... >> The point of defensive programming is preventing the problems you ...
    (comp.lang.c)
  • Re: The philosophy of errno
    ... >condition using errno. ... >What is the good programming for this? ... >set errno to the appropriate code in case of error ... compile this with gcc x.c ...
    (comp.os.linux.development.apps)
  • Why does this (very simple piece of) code does not work?
    ... OSError: [Errno 22] Invalid argument ... TIA, ...
    (comp.lang.python)