lkml.org 
[lkml]   [2014]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] checkpatch: Add --strict preference for #defines using BIT(foo)
On Fri, 07 Nov 2014 13:15:39 -0800 Joe Perches <joe@perches.com> wrote:

> Using BIT(foo) and BIT_ULL(bar) is more common now.
> Suggest using these macros over #defines with 1<<value.

urgh. I'm counting eightish implementations of BIT(), an unknown
number of which are actually being used. Many use 1<<n, some use
1UL<<N, another uses 1ULL<<n. I'm a bit reluctant to recommend that
anyone should use BIT() until it has has some vigorous scrubbing :(

Is it actually an improvement? If I see

#define X (1U << 7)

then I know exactly what it does. Whereas when I see

#define X BIT(7)

I know neither the size or the signedness of X so I have to go look it
up.


I have no strong feelings either way, but I'm wondering what might have
inspired this change?



\
 
 \ /
  Last update: 2014-11-11 01:01    [W:0.046 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site