Date: Fri, 5 Dec 2008 00:35:31 -0800 From: "Garrett Cooper" <yanefbsd@gmail.com> To: "Maksim Yevmenkin" <maksim.yevmenkin@gmail.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: RFC: small syscons and kbd patch Message-ID: <7d6fde3d0812050035u6e3ea930o9e093830a8608444@mail.gmail.com> In-Reply-To: <7d6fde3d0812050034y43a70ce8i49fbba92f9c8943b@mail.gmail.com> References: <bb4a86c70812021701i621fdcfjb6a58a7f5cf781d5@mail.gmail.com> <7d6fde3d0812040324y3bf0901cy1f4a6d961362c314@mail.gmail.com> <bb4a86c70812040724w43ddec15yab72920d80d879d3@mail.gmail.com> <20081205072229.GE18652@hoeg.nl> <7d6fde3d0812050034y43a70ce8i49fbba92f9c8943b@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 4, 2008 at 11:22 PM, Ed Schouten <ed@80386.nl> wrote: > * 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. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d0812050035u6e3ea930o9e093830a8608444>