Documentation/4.0/Developers/Style Guide/Cpp

From Slicer Wiki
Revision as of 07:31, 14 June 2013 by UpdateBot (talk | contribs) (Prepend documentation/versioncheck template. See http://na-mic.org/Mantis/view.php?id=2887)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Documentation < 4.0 < Developers < Style Guide < Cpp


For the latest Slicer documentation, visit the read-the-docs.



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