Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Dec 2008 13:35:31 +0200
From:      Andriy Gapon <avg@icyb.net.ua>
To:        Ed Schouten <ed@80386.nl>
Cc:        Garrett Cooper <yanefbsd@gmail.com>, "current@freebsd.org" <current@freebsd.org>, Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
Subject:   Re: RFC: small syscons and kbd patch
Message-ID:  <49391203.9070009@icyb.net.ua>
In-Reply-To: <20081205072229.GE18652@hoeg.nl>
References:  <bb4a86c70812021701i621fdcfjb6a58a7f5cf781d5@mail.gmail.com>	<7d6fde3d0812040324y3bf0901cy1f4a6d961362c314@mail.gmail.com>	<bb4a86c70812040724w43ddec15yab72920d80d879d3@mail.gmail.com> <20081205072229.GE18652@hoeg.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
on 05/12/2008 09:22 Ed Schouten said the following:
> * Maksim Yevmenkin <maksim.yevmenkin@gmail.com> wrote:
>> the idea was to ensure that kbd->kb_locked variable only takes values
>> 0 (zero) and 1 (one).
> 
> I often use constructs like these to do that:
> 
> 	foo = bar ? 1 : 0;
> 
> Maybe !!bar is a lot shorter to write, I think the line above is a lot
> easier to read.

Another variation is:
foo = (bar != 0);

I think that this is something in the middle.
BTW, gcc 4.2 produces exactly the same assembly for all 3 forms.

-- 
Andriy Gapon



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