bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-indent] brace-line-up feature mod for indent


From: david ingamells
Subject: Re: [Bug-indent] brace-line-up feature mod for indent
Date: Tue, 30 Jul 2002 21:25:32 +0200

Daniel,
The style that you propose, while not one I personally would like to use, 
seems as logically consistent as many (e.g. GNU's style). Many styles, with 
the "exdented" style as a notable exception, are not consistent with function 
braces, so Kim's arguments would also exclude many styles that indent 
currently does support.
I've looked at the GNU style guide and it seems that GNU recommends this:

if (x)
  {
    statement();
  }
else
  another_statement();

Here the single statement is aligned with the open brace of the block 
statement which is indented two characters from the if statement, and within 
the braces of a block the lines are indented a further two characters. This 
must be my most hated style ever.

Both indentations are of two characters. Before adding any new switch I want 
to look at how indent uses those two 2's - it might be that the numbers are 
being used the wrong way around and since they are both 2 it doesn't show up 
with the GNU style. 

David.

On Thursday 25 July 2002 11:49 pm, Daniel Gryniewicz wrote:
> On Thu, 2002-07-25 at 17:21, Kim Saunders wrote:
> > > > Are you wanting something like this:
> > > >
> > > > void foo ()
> > > > {
> > > >     int bar;
> > > >
> > > >     if (a)
> > > >         {
> > > >         bar++;
> > > >         }
> > > >     else
> > > >         bar--;
> > > > }
> > > >
> > > > KimS
> > >
> > > Yes, that's what I want.  The differently indented code is a problem
> > > too, but not my problem as I don't use that style.  My problem is that
> > > indent doesn't do my style at all. :(
> >
> > Yes... that's because your style is somewhat inconsistent, with code
> > indented inside function braces, but non inside conditional braces.
> >
> > My personal opinion (as an indent *user*) is that this isn't really
> > something indent should do (it's meant to make code *consistent*).
> >
> > KimS
>
> Sorry if this gets sent twice, I'm not sure it worked the first time.
>
> Let me justify why I think I have a more consistent style.  I believe
> that a code block should be exactly equivalent to a single line of
> code.  I call this the function-replacement test.  If I replace a block
> with a function call, no indenting should change.  So, the braces should
> line up with the code they enclose, and the whole should be indented in
> the same way a single line of code would.  The way indent works now
> fails this test, and so is less consistent in my opinion.  As to the
> function braces, convention is that function braces are always in the
> first column.  I've never seen a coding style (including BSD, which puts
> all other braces on the same line as the conditional) that does not do
> this.  I don't believe that's an issue.
>
> Daniel
>
>
> _______________________________________________
> Bug-indent mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-indent

-- 
David Ingamells
address@hidden
+31 (013) 5093388     (home)
+31 615010947 (mobile)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]