From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Garzik Subject: Re: sfc: an enumeration is not a bitmask Date: Tue, 17 May 2011 18:00:12 -0400 Message-ID: <4DD2EFEC.9040504@pobox.com> References: <20110517.141446.140687548350861625.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: David Miller , bhutchings@solarflare.com, netdev@vger.kernel.org To: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Return-path: Received: from mail-gw0-f46.google.com ([74.125.83.46]:46444 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932389Ab1EQWAR (ORCPT ); Tue, 17 May 2011 18:00:17 -0400 Received: by gwaa18 with SMTP id a18so333819gwa.19 for ; Tue, 17 May 2011 15:00:16 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On 05/17/2011 03:09 PM, Micha=C5=82 Miros=C5=82aw wrote: > 2011/5/17 Jeff Garzik: >> 2011/5/17 David Miller: >>> An enumeration is not a bitmask, instead it means one out of the se= t >>> 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 an= d >> 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. Jeff