[vtk-developers] VTK Coding Standards, C++11 override and =delete

Sean McBride sean at rogue-research.com
Thu May 5 14:19:17 EDT 2016


Hi all,

A lot of VTK cleanup like adding more const correctness, changing various 'int's to 'bool's, etc. technically changes the API and could affect users (and subclassers especially).  To help minimize problems, VTK really should start using the C++11 'override' keyword.  I hope that's not controversial. :)

I've taken a first stab here:
<https://gitlab.kitware.com/vtk/vtk/merge_requests/1458>

It's the kind of change that touches every file, and, practically speaking, must be done bit by bit over time.  The first addition will introduce new warnings in C++11 mode (at least with clang) and can't all be fixed until 'override' is added everywhere it belongs.

It might be good to update the Coding Standards to mandate using VTK_OVERRIDE in new code.

---

Relatedly, I've added a VTK_DELETE_FUNCTION here:
<https://gitlab.kitware.com/vtk/vtk/merge_requests/1459>

and that implies changing Item 14, which currently reads: "Classes that derive from vtkObject should have protected constructors and destructors, and privately declared but unimplemented copy constructor and assignment operator."  We should now say that VTK_DELETE_FUNCTION should be used.

---

Both these changes are backwards compatible with C++03 thanks to macros.

Thoughts?

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtk-developers mailing list