[vtk-developers] PROPOSAL: Changing VTK's indentation style

Brad King brad.king at kitware.com
Wed Sep 9 15:41:46 EDT 2015


On 9/9/2015 9:53 AM, Shawn Waldon wrote:
> It would be nice to have a format that doesn't require twiddling
> with the editor(s) so much.

Yes.

> Having said that, I prefer that we do what
> Brad suggested and use clang-format.

After further thought I think we should delay consideration of
clang-format.  Let's not allow it to get in the way of Berk's
original proposal.  It has a lot of +1s.

On 9/9/2015 9:22 AM, David Lonie wrote:
>   if (...) {
>     ...
>   }
>   else {
>     ...
>   }
[snip]
On 9/9/2015 9:43 AM, Ben Boeckel wrote:
> I've preferred using "} else {"

I also like

  if (...) {
    ...
  } else {
    ...
  }

and it seems to be widely used.  The placement of the opening
curly on the block opening line or on its own line does not
affect the indentation of the code inside the curly braces,
so this choice can be made locally rather than mandated
globally.

--------------------------------------------------------------------

I propose that we start with a sweeping change implementing
Berk's original proposal of just moving the curly braces up
one level of indentation:

  if (...)
  {
    ...
  }
  else
  {
    ...
  }

Then in future edits and/or new code we can allow the opening
"{" to be either on its own line or on the block opening line as
preferred by individuals.  Changes to curly brace placement can
be made incrementally as code is edited to avoid blame poisoning.

-Brad


More information about the vtk-developers mailing list