lkml.org 
[lkml]   [2005]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Use enum to declare errno values
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-11-23 16:58    [W:0.117 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site