[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTi=C24pTxhMRtaT40Rrj9Z1s+DH=jg@mail.gmail.com>
Date: Wed, 18 May 2011 01:19:01 +0200
From: Michał Mirosław <mirqus@...il.com>
To: Jeff Garzik <jgarzik@...ox.com>
Cc: David Miller <davem@...emloft.net>, bhutchings@...arflare.com,
netdev@...r.kernel.org
Subject: Re: sfc: an enumeration is not a bitmask
W dniu 18 maja 2011 00:00 użytkownik Jeff Garzik <jgarzik@...ox.com> napisał:
> On 05/17/2011 03:09 PM, Michał Mirosław wrote:
>> 2011/5/17 Jeff Garzik<jgarzik@...ox.com>:
>>> 2011/5/17 David Miller<davem@...emloft.net>:
>>>> An enumeration is not a bitmask, instead it means one out of the set
>>>> of enumerated values will be used.
>>> It's a decade-old kernel practice to use 'enum' to define typed
>>> constants, preferred over macros that convey no type information and
>>> disappear after cpp phase.
>>>
>>> So your assertion about enumerations is demonstrably not true, as it
>>> is often used in the kernel. Call it enum abuse if you want, but it
>>> is consistent with code all over the kernel.
>> Old age of the mistake doesn't make it correct.
> It is not a mistake, but a useful coding tool.
Being it a mistake does not contradict usefulness. ;-)
C has bitfields for the uses where masks and shifts are usually used.
Unfortunately, those usually require more typing and sometimes compile
to worse code.
Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists