Re: Use enum to declare errno values

From: Nikita Danilov
Date: Wed Nov 23 2005 - 10:55:32 EST


moreau francis writes:

[...]

>
> I guess we won't use enumeration because it needs to many changes...Each
> function that returns a errno value should have their prototype changed like
> this:
>
> int foo(void)
> {
> int retval;
> [...]
> return retval;
> }
>
> should be changed into
>
> enum errnoval foo(void)
> {
> enum errnoval retval;
> [...]
> return retval;
> }

No it shouldn't. Following is a perfectly legal thing to do in C:

enum side {
LEFT,
RIGHT
};

int foo(int x)
{
if (x & 0x1)
return LEFT;
else
return RIGHT;
}

This is not C++ fortunately.

Nikita.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/