lkml.org 
[lkml]   [2005]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Use enum to declare errno values
Alan Cox wrote:
> 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
>

Well, perhaps better, since there is some type checking, and where
auto-increment can be used finger checks don't generate duplicate values
or undefined holes in the value set.

Like the struct definitions vs. old K&R definitions, there is a mental
style adjustment to be made.
--
-bill davidsen (davidsen@tmr.com)
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me

-
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 18:52    [W:0.067 / U:1.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site