Difference between revisions of "Documentation/4.1/Developers/Style Guide/Cpp"

From Slicer Wiki
Jump to: navigation, search
Line 1: Line 1:
{{documentation/underconstruction}}
+
__TOC__
  
 
{{ambox|text=
 
{{ambox|text=
Line 52: Line 52:
 
* http://universalindent.sourceforge.net/
 
* http://universalindent.sourceforge.net/
 
* http://uncrustify.sourceforge.net/
 
* http://uncrustify.sourceforge.net/
 +
 +
{{documentation/underconstruction}}

Revision as of 21:16, 1 June 2012

Home < Documentation < 4.1 < Developers < Style Guide < Cpp

Indentation

Configure your text editor to do VTK style indentation:

Naming

  • Local variable should start with a lower case.
    • For example:
void vtkSlicerSliceLogic::SetForegroundLayer(vtkSlicerSliceLayerLogic *ForegroundLayer) // wrong!

should be

void vtkSlicerSliceLogic::SetForegroundLayer(vtkSlicerSliceLayerLogic *foregroundLayer)
  • Member variable should start with a capital letter, and in implementation should be used in conjunction with 'this->' convention
    • For example
class Node {
  Object &Foo();
  Object Bla;
};
Object& Node::Foo()
{
  return this->Bla;
}


References

Tools