Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1409179
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details |
| Date | 2016-05-30 16:40 +0200 |
| Message-ID | <rEwwi-5os-33@gated-at.bofh.it> (permalink) |
| References | <rEacp-7x8-15@gated-at.bofh.it> <rEavL-7SI-1@gated-at.bofh.it> <rEwmB-5kR-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, 2016-05-30 at 22:21 +0800, Chen Gang wrote:
> On 5/29/16 23:08, Joe Perches wrote:
> > On Sun, 2016-05-29 at 22:36 +0800, chengang@emindsoft.com.cn wrote:
> > > Use "!!" to let the boolean function return boolean value directly.
> > []
> > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> > []
> > > @@ -191,12 +190,12 @@ static inline bool movable_node_is_enabled(void)
> > > static inline bool memblock_is_mirror(struct memblock_region *m)
> > > {
> > > - return m->flags & MEMBLOCK_MIRROR;
> > > + return !!(m->flags & MEMBLOCK_MIRROR);
> > These !! uses are't necessary.
> > The compiler makes the bool return 0 or 1.
> No, they are not necessary. But for me, it will be more clearer, since
> in our kernel (at least in include/linux/), almost all Boolean functions
> use Boolean value or expression for return (and "!!" are often used).
Opinions vary.
There seem to be fewer than 20 !! uses in bool return
functions in include/linux/
Finding the quantity of bool conversions in include/linux
from something other than 0, 1, true, or false to 0 or 1
is not trivial, but it is non-zero and seems rather more
than 20.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details chengang@emindsoft.com.cn - 2016-05-29 16:50 +0200
Re: [PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details Joe Perches <joe@perches.com> - 2016-05-29 17:10 +0200
Re: [PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details Chen Gang <chengang@emindsoft.com.cn> - 2016-05-30 16:30 +0200
Re: [PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details Joe Perches <joe@perches.com> - 2016-05-30 16:40 +0200
Re: [PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details Chen Gang <chengang@emindsoft.com.cn> - 2016-05-31 00:20 +0200
Re: [PATCH trivial] include/linux/memblock.h: Clean up code for several trivial details Chen Gang <chengang@emindsoft.com.cn> - 2016-05-31 04:10 +0200
csiph-web