Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2001 15:13:46 +1000
From:      Stephen McKay <mckay@thehub.com.au>
To:        Jonathon McKitrick <jcm@shellyeah.org>
Cc:        "Matthew D. Fuller" <fullermd@futuresouth.com>, j mckitrick <jcm@FreeBSD-uk.eu.org>, chat@FreeBSD.ORG, mckay@thehub.com.au
Subject:   Re: silly C style question 
Message-ID:  <200101260513.f0Q5DkF18296@dungeon.home>
In-Reply-To: <Pine.GSO.4.21.0101251203570.24119-100000@zippy.shellyeah.org> from Jonathon McKitrick at "Thu, 25 Jan 2001 12:07:11 -0500"
References:  <Pine.GSO.4.21.0101251203570.24119-100000@zippy.shellyeah.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101260513.f0Q5DkF18296>