From owner-freebsd-chat Thu Jan 25 21:13:26 2001 Delivered-To: freebsd-chat@freebsd.org Received: from ns5.pacific.net.au (ns5.pacific.net.au [203.143.252.30]) by hub.freebsd.org (Postfix) with ESMTP id 7EC4637B401 for ; Thu, 25 Jan 2001 21:13:08 -0800 (PST) Received: from dungeon.home (ppp119.dyn249.pacific.net.au [203.143.249.119]) by ns5.pacific.net.au (8.9.0/8.9.1) with ESMTP id QAA13098; Fri, 26 Jan 2001 16:13:03 +1100 (EST) Received: from dungeon.home (localhost [127.0.0.1]) by dungeon.home (8.11.1/8.9.3) with ESMTP id f0Q5DkF18296; Fri, 26 Jan 2001 15:13:46 +1000 (EST) (envelope-from mckay) Message-Id: <200101260513.f0Q5DkF18296@dungeon.home> To: Jonathon McKitrick Cc: "Matthew D. Fuller" , j mckitrick , chat@FreeBSD.ORG, mckay@thehub.com.au Subject: Re: silly C style question References: In-Reply-To: from Jonathon McKitrick at "Thu, 25 Jan 2001 12:07:11 -0500" Date: Fri, 26 Jan 2001 15:13:46 +1000 From: Stephen McKay Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Thursday, 25th January 2001, Jonathon McKitrick wrote: >> >> Use neither of these! Use: >> >> >> >> if (i == 0) >> >> { >> >> foo(i); >> >> bar(i); >> >> } >> Go on! Give it a go! It grows on you. And it's logical too. Just >> think of the language components like a parser would and group logical >> units together. >I see your point, Partial victory! Woohoo! >but not indenting the brace saves a keystroke, and that can add up. Don't be silly! If we were coding simply to minimise keystrokes, we wouldn't use indenting at all! Anyway, it doesn't use an extra keystroke because it is either "space { newline ^T" for mine or "newline ^T { newline" for K&R. (Some of you heathens might use tab instead of ^T. Separate issue.) >Also, following the column straight down from the 'if' or >other conditional takes you directly to where the execution path >continues. I like that better than just following the indentation. So you are agreeing with me? When you run your eye down a column you see the important stuff and when you hit a bracket, you know you have reached the end of a block. Eg: { if (...) { .. } while (...) { .. } x = y; } You see a conditional, a loop and an assignment. One of those "hide the details" editors could present this as: { if (...)... while (...)... x = y; } I don't have such an editor, but I think that way. I assume there is an emacs mode for this. :-) Stephen. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message