Re: Use enum to declare errno values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux