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: Daniel Gryniewicz
Subject: Re: [Bug-indent] brace-line-up feature mod for indent
Date: 25 Jul 2002 17:49:32 -0400

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 




reply via email to

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