Re: Use enum to declare errno values

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

 



--- Alan Cox <[email protected]> a écrit :

> On Mer, 2005-11-23 at 16:31 +0200, Denis Vlasenko wrote:
> > Enums are really nice substitute for integer constants instead of #defines.
> > Enums obey scope rules, #defines do not.
> > 
> > However enums are not widely used because of
> > 1. tradition and style
> > 2. awkward syntax required:   enum { ABC = 123 };
> 
> The SATA layer uses enum for constants and while it was a bit of change
> in style when I met it, it does seem to work just as well
> 
> 

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;
    }


Thanks


	
	
		
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com
-
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