From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 5 08:35:31 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E23111065673 for ; Fri, 5 Dec 2008 08:35:31 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from po-out-1718.google.com (po-out-1718.google.com [72.14.252.155]) by mx1.freebsd.org (Postfix) with ESMTP id AC8098FC0A for ; Fri, 5 Dec 2008 08:35:31 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by po-out-1718.google.com with SMTP id y22so6868649pof.3 for ; Fri, 05 Dec 2008 00:35:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=BDKd9I8rQ/OR6InTuShPul3A2v8srGzdjE1v5TMIzjM=; b=JnosJB2eqg0S8P9l9Kqy6TxaLzdqAIPljpzniI9uxkzUQ3mtsFXA398jTIW7i17QKz U+bbKRng7PcCdaPMniOdxOfAoqW5WdCnjOOwnOCDGET5OeuZYSlGhe4TtdstuLljhzaE oCdBVX5J9r4kio7vYgS1nThP0Ai9sJ6+fP1N4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=D9J8XMDDXwKGUglJa39zh0paz7rNZBVDPyW7tZApqVvYBXN1/eKxjSwXlQx54Wzp0I IP3k5u9mbZPyxawQQgclV92hvCw0HdczMHL600lJwBIFcCyNi9r350iU0Yg3SaEk1xfR riplsA0TEa59AaSpDC54Fvd05Ry4HJHythuME= Received: by 10.140.128.3 with SMTP id a3mr7409837rvd.232.1228466131453; Fri, 05 Dec 2008 00:35:31 -0800 (PST) Received: by 10.140.158.13 with HTTP; Fri, 5 Dec 2008 00:35:31 -0800 (PST) Message-ID: <7d6fde3d0812050035u6e3ea930o9e093830a8608444@mail.gmail.com> Date: Fri, 5 Dec 2008 00:35:31 -0800 From: "Garrett Cooper" To: "Maksim Yevmenkin" In-Reply-To: <7d6fde3d0812050034y43a70ce8i49fbba92f9c8943b@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7d6fde3d0812040324y3bf0901cy1f4a6d961362c314@mail.gmail.com> <20081205072229.GE18652@hoeg.nl> <7d6fde3d0812050034y43a70ce8i49fbba92f9c8943b@mail.gmail.com> Cc: FreeBSD Hackers Subject: RFC: small syscons and kbd patch X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 08:35:32 -0000 On Thu, Dec 4, 2008 at 11:22 PM, Ed Schouten wrote: > * Maksim Yevmenkin 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