linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Fernando Capitulino <lcapitulino@conectiva.com.br>
To: linux-c-programming@vger.kernel.org
Subject: errno usage.
Date: Fri, 29 Jul 2005 12:00:29 -0300	[thread overview]
Message-ID: <42EA448D.6080904@conectiva.com.br> (raw)

Hi, hi, hi there!

  I have a question about 'errno' which I'm postponing for some
time: is it a bad pratice to set 'errno' by hand in libraries
and even in ordinary programs?

I mean, AFAIK 'errno' was created to store error codes from system
calls, but it's widely used by several libraries. Sometimes is even
helpful to set 'errno' in the program itself, something like:

int get_foobar_info(char *value)
{
	if (!value) {
		errno = EINVAL;
		return -1;
	}

...

	return 0;
}

Is it a bad pratice? Is there a 'limit' for 'errno' usage?

Thank you!


             reply	other threads:[~2005-07-29 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-29 15:00 Luiz Fernando Capitulino [this message]
2005-07-30 12:56 ` errno usage Glynn Clements
2005-08-01  7:22   ` Steve Graegert
2005-08-01 11:00     ` Glynn Clements
2005-08-01  9:46       ` Steve Graegert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42EA448D.6080904@conectiva.com.br \
    --to=lcapitulino@conectiva.com.br \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).