RFC: small syscons and kbd patch

Garrett Cooper yanefbsd at gmail.com
Fri Dec 5 00:35:32 PST 2008


On Thu, Dec 4, 2008 at 11:22 PM, Ed Schouten <ed at 80386.nl> wrote:
> * Maksim Yevmenkin <maksim.yevmenkin at 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.

Indeed. I had no idea (and I would assume that many people wouldn't in
my similar level of systems programming) what in the work you were
trying to do above with that line. The one-line conditional is
universal in almost all major high-level language dialects I've hit,
minus Python and Tcl.
-Garrett


More information about the freebsd-hackers mailing list