From: "Michał Mirosław" <mirqus@gmail.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: David Miller <davem@davemloft.net>,
bhutchings@solarflare.com, netdev@vger.kernel.org
Subject: Re: sfc: an enumeration is not a bitmask
Date: Wed, 18 May 2011 01:19:01 +0200 [thread overview]
Message-ID: <BANLkTi=C24pTxhMRtaT40Rrj9Z1s+DH=jg@mail.gmail.com> (raw)
In-Reply-To: <4DD2EFEC.9040504@pobox.com>
W dniu 18 maja 2011 00:00 użytkownik Jeff Garzik <jgarzik@pobox.com> napisał:
> On 05/17/2011 03:09 PM, Michał Mirosław wrote:
>> 2011/5/17 Jeff Garzik<jgarzik@pobox.com>:
>>> 2011/5/17 David Miller<davem@davemloft.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
prev parent reply other threads:[~2011-05-17 23:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 18:14 sfc: an enumeration is not a bitmask David Miller
2011-05-17 18:18 ` Ben Hutchings
2011-05-17 18:23 ` David Miller
2011-05-17 18:48 ` [PATCH net-next-2.6] sfc: Suppress warning about combining enum flags by gcc 4.5 Ben Hutchings
2011-05-17 19:26 ` David Miller
2011-05-17 21:06 ` [PATCH net-next-2.6] sfc: Replace enum efx_fc_type with a 'bitwise' type Ben Hutchings
2011-05-17 21:14 ` David Miller
2011-05-17 21:22 ` Joe Perches
2011-05-17 21:28 ` David Miller
2011-05-17 21:30 ` Michał Mirosław
2011-05-17 21:36 ` Eric Dumazet
2011-05-17 21:43 ` Joe Perches
2011-05-17 21:43 ` [PATCH net-next-2.6] sfc: Replace enum efx_fc_type with macros and type alias Ben Hutchings
2011-05-17 21:45 ` David Miller
2011-05-18 2:01 ` [PATCH net-next-2.6] sfc: Replace enum efx_fc_type with a 'bitwise' type Jeff Garzik
2011-05-18 2:23 ` David Miller
2011-05-18 2:59 ` Jeff Garzik
2011-05-17 18:57 ` sfc: an enumeration is not a bitmask Jeff Garzik
2011-05-17 19:09 ` Michał Mirosław
2011-05-17 19:22 ` Ben Hutchings
2011-05-17 22:00 ` Jeff Garzik
2011-05-17 23:19 ` Michał Mirosław [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTi=C24pTxhMRtaT40Rrj9Z1s+DH=jg@mail.gmail.com' \
--to=mirqus@gmail.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).