From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 5 08:50:38 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 EAFBD1065673 for ; Fri, 5 Dec 2008 08:50:38 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from po-out-1718.google.com (po-out-1718.google.com [72.14.252.159]) by mx1.freebsd.org (Postfix) with ESMTP id B83FA8FC13 for ; Fri, 5 Dec 2008 08:50:38 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by po-out-1718.google.com with SMTP id y22so6876098pof.3 for ; Fri, 05 Dec 2008 00:50:38 -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=h8DPyRlmOFHKrZOeO4cxzX0wFRHort2P97jg+LRnUvw=; b=Ln3pnydy6eNd7uoOrakAv+lhlnml5sboorZ/ph0aeo9ds35Y9RQ3/2B73j3h1exC9j zYWEP+8HbhWwxp4xND20SiQK5ZEv/vU9go90Gr00W5WfxUvqm5yCAfkQgKUCnE/eZwLz YF7o98NQHSmgl77Jc8aZkmyCjz+hExTb/N4mA= 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=LZOSfX0oEXE1Xk5GDz9PSAWiYP3f5PQye5/90GXBo0M4J4Q4Lv6xNnYhPsLque8tSj lYyWg2y0uiaStGjikalvp4ET0evqr/ZvU1RQXch629lbF12WTGuXBVPCXzyQ+pzthqly Mbj/HSl6fPOJyZGjMBUmokNXnDy3QFLq0RxBA= Received: by 10.141.45.16 with SMTP id x16mr7429469rvj.85.1228467038390; Fri, 05 Dec 2008 00:50:38 -0800 (PST) Received: by 10.140.158.13 with HTTP; Fri, 5 Dec 2008 00:50:38 -0800 (PST) Message-ID: <7d6fde3d0812050050l57684eebkf14f252d78b68ec0@mail.gmail.com> Date: Fri, 5 Dec 2008 00:50:38 -0800 From: "Garrett Cooper" To: "Erik Trulsson" In-Reply-To: <20081205084441.GA29312@owl.midgard.homeip.net> 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> <7d6fde3d0812050035u6e3ea930o9e093830a8608444@mail.gmail.com> <20081205084441.GA29312@owl.midgard.homeip.net> Cc: FreeBSD Hackers , Maksim Yevmenkin Subject: Re: 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:50:39 -0000 On Fri, Dec 5, 2008 at 12:44 AM, Erik Trulsson wrote: > On Fri, Dec 05, 2008 at 12:35:31AM -0800, Garrett Cooper wrote: >> 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 > > The !!bar construction to map {0, not-0} to {0,1} is fairly common in C > programming, and I would certainly expect any experienced C programmer to > recognize it. (I feel like I'm getting off on a bikeshed topic, but...) 1. What dialect of C was it defined in? Is it still used in the standard dialect (honestly, this is the first time I've ever seen it before, but then again I am a younger generation user)? 2. Is it still taught in schools (I didn't learn it when I was taught C)? If not in schools, what about the Richie text (it's sort of like the defacto C programming standard book of course)? 3. What's the real loss of going to `? :', beyond maybe 3 extra keystrokes if it's easier for folks who may not be as experienced to read? -Garrett