linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* errno usage.
@ 2005-07-29 15:00 Luiz Fernando Capitulino
  2005-07-30 12:56 ` Glynn Clements
  0 siblings, 1 reply; 5+ messages in thread
From: Luiz Fernando Capitulino @ 2005-07-29 15:00 UTC (permalink / raw)
  To: linux-c-programming

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!


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-01 11:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-29 15:00 errno usage Luiz Fernando Capitulino
2005-07-30 12:56 ` Glynn Clements
2005-08-01  7:22   ` Steve Graegert
2005-08-01 11:00     ` Glynn Clements
2005-08-01  9:46       ` Steve Graegert

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).