From owner-freebsd-current Fri Jan 29 16:19:52 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA09436 for freebsd-current-outgoing; Fri, 29 Jan 1999 16:19:52 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA09431 for ; Fri, 29 Jan 1999 16:19:49 -0800 (PST) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id KAA05725; Sat, 30 Jan 1999 10:49:45 +1030 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.2/8.9.0) id KAA24026; Sat, 30 Jan 1999 10:49:43 +1030 (CST) Date: Sat, 30 Jan 1999 10:49:43 +1030 From: Greg Lehey To: Warner Losh Cc: Julian Elischer , current@FreeBSD.ORG Subject: Re: btokup().. patch to STYLE(9) (fwd) Message-ID: <19990130104943.W8473@freebie.lemis.com> References: <199901291802.LAA67403@harmony.village.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i In-Reply-To: <199901291802.LAA67403@harmony.village.org>; from Warner Losh on Fri, Jan 29, 1999 at 11:02:48AM -0700 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Friday, 29 January 1999 at 11:02:48 -0700, Warner Losh wrote: >> If I were working on this code written by someone else it'd leave my >> editor looking like the top example, that's for sure. I think that >> "How easy is it to edit a piece of code and still have it do what you >> expect" is an important consideration, because people DO edit things. > > Agreed. > >>> I do agree that complex things like: >>> >>> if (a | b & c % d ^ e) >>> >>> should really have some parents to show what is going on. >> >> I have NO idea of what that is doing and I have plans of looking it up in >> the book to work it out.. > > Yes. I agree with that. > if (a | b & c % d ^ e) > should have been written as: > if (((a | (b & (c % d))) ^ e) != 0) > (then again, either way it is ugly code and should have comments). It's interesting that this whole argument has just addressed the syntax, and nobody has given any consideration to the semantics. In this example, all variables are a single character. Given the fact that this expression is probably indented 16 characters, there's a strong incentive to keep the variable names short, even at the expense of intelligibility. Consider one possible expansion if (((allocationfail | (IGNOREFAILUREMASK & (incount % BLKSIZE))) ^ failures) != 0) (yes, this still doesn't make sense, but I can't be bothered to look for something more appropriate) This is now 99 characters wide, and it's the kind of code which doesn't gain in legibility by being broken into multiple lines, especially if the indentation of the follow-on lines is independent of the structure of the expression. bde has made it clear he considers code more than 80 characters wide to be Evil. Question: how many people still limit their editor windows to 80 characters? Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message