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

Scott, W Alan wascott at sandia.gov
Wed Sep 9 16:32:45 EDT 2015


+10 to this comment.

From: vtk-developers [mailto:vtk-developers-bounces at vtk.org] On Behalf Of Ken Martin
Sent: Wednesday, September 09, 2015 2:26 PM
To: Geveci, Berk (External Contact); Brad King
Cc: VTK Developers
Subject: [EXTERNAL] Re: [vtk-developers] PROPOSAL: Changing VTK's indentation style

If ()
{
  Blah
}

+2

If () {
  Blah
}

+1

Allowing people to use whichever one they feel like

-10

I find that code consistency makes it a lot easier for me to get into a new class in VTK.  So I would say if you want to move to “if () {“ then do it all at once and then that is the standard. I think most everyone agrees that Berk’s original suggestion is an improvement. I’m not as sure about switching to “if () { “ I think that could be more divisive. Maybe not.


FWIW my brain still hurts when I see four different ways of creating an instance spread throughout the code ala

VTK_NEW(class)
vtkNew<class>
vtkSmartPointer<class>
class::New()

I have no clue which one to use so I try to use them all equally, in the same function :-)


Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
ken.martin at kitware.com<mailto:ken.martin at kitware.com>
919 869-8871 (w)


This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee.  Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message.  Thank you.

From: vtk-developers [mailto:vtk-developers-bounces at vtk.org<mailto:vtk-developers-bounces at vtk.org>] On Behalf Of Berk Geveci
Sent: Wednesday, September 9, 2015 3:57 PM
To: Brad King
Cc: VTK Developers
Subject: Re: [vtk-developers] PROPOSAL: Changing VTK's indentation style

+1 to Brad's suggestion,

On Wed, Sep 9, 2015 at 3:41 PM, Brad King <brad.king at kitware.com<mailto:brad.king at kitware.com>> wrote:
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
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150909/20b243f9/attachment.html>


More information about the vtk-developers mailing list