From owner-freebsd-chat Mon Jan 22 17: 3:24 2001 Delivered-To: freebsd-chat@freebsd.org Received: from smtp05.primenet.com (smtp05.primenet.com [206.165.6.135]) by hub.freebsd.org (Postfix) with ESMTP id 8FC7037B402 for ; Mon, 22 Jan 2001 17:03:06 -0800 (PST) Received: (from daemon@localhost) by smtp05.primenet.com (8.9.3/8.9.3) id RAA27635; Mon, 22 Jan 2001 17:58:38 -0700 (MST) Received: from usr08.primenet.com(206.165.6.208) via SMTP by smtp05.primenet.com, id smtpdAAAjZaq61; Mon Jan 22 17:58:30 2001 Received: (from tlambert@localhost) by usr08.primenet.com (8.8.5/8.8.5) id SAA06571; Mon, 22 Jan 2001 18:02:54 -0700 (MST) From: Terry Lambert Message-Id: <200101230102.SAA06571@usr08.primenet.com> Subject: Re: silly C style question To: tl001@online.no (Tore Lund) Date: Tue, 23 Jan 2001 01:02:54 +0000 (GMT) Cc: freebsd-chat@FreeBSD.ORG In-Reply-To: <3A6C72DC.7F5F817@online.no> from "Tore Lund" at Jan 22, 2001 06:50:20 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > if (0 == i) > > { > > foo(i); > > bar(i); > > } vs. > > if (0 == i) { > > foo(i); > > bar(i); > > } [ ... ] > Unfortunately, there is no objective way to decide which style makes the > code easier to read. Take a look through the FreeBSD sources, and you > may realize what sort of flame war you have just started. At least this > is closer to topic than the discussion on mobile phones. Actually, I think style preference has a lot to do with the tools you use, particularly your editor. The second version lets me hit "$%" in vi, for example, to do a quick block skip, if the block of code in question is not of interest (e.g. if I knew 'i' was not zero). I have also seen a lot of "qed" users, who don't like the block spacing used: > > if (0 == i) { > > foo(i); > > bar(i); > > } And prefer: > > if( 0 == i) { > > foo( i); > > bar( i); > > } For similar editor usage reasons. As to comparing zero to 'i', instead of the other way around, well... }B^). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message