Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Apr 2011 14:07:31 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r221059 - in head/sys: kern sys
Message-ID:  <201104261407.31963.hselasky@c2i.net>
In-Reply-To: <20110426115333.GP48734@deviant.kiev.zoral.com.ua>
References:  <201104261139.p3QBduVx020817@svn.freebsd.org> <201104261344.00551.hselasky@c2i.net> <20110426115333.GP48734@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 26 April 2011 13:53:33 Kostik Belousov wrote:
> On Tue, Apr 26, 2011 at 01:44:00PM +0200, Hans Petter Selasky wrote:
> > On Tuesday 26 April 2011 13:39:56 Konstantin Belousov wrote:
> > > +       pending = !!callout_stop(&timeout_task->c);
> > 
> > pending = (callout_stop(&timeout_task->c) != 0);
> > 
> > ?

Hi,

This is just a nit I noticed.

> 
> This line is about conversion from a boolean value to {0, 1} value set.
> If !! construct does not look stylish, then wouldn't we need to go
> with
> 	pending = (callout_stop(&timeout_task->c) != 0) ? 1 : 0;
> instead ?

The output from ! is already a boolean and "pending" is a u_int, so to be 
correct it should be similar to what you suggest. I'm not sure what case 
produce the less amount of code and which the compiler understands the best. 
Probably it does not matter that much.

I was thinking that "!!" is depreceated, but "man style" is silent about it.

> Feel free to adjust whatever variant you prefer and commit it.

Ok.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104261407.31963.hselasky>