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!

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" 
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to