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

Marcus D. Hanwell marcus.hanwell at kitware.com
Thu May 5 15:55:22 EDT 2016


On Thu, May 5, 2016 at 2:19 PM, Sean McBride <sean at rogue-research.com> wrote:
> 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.

One question I have for style, and I may be a minimalist, but using
the virtual and override keyword for the same declaration seems overly
redundant. The override keyword tells me it is overriding a virtual,
couldn't we just use that? I totally agree on its use, and I know both
are correct, but why not replace virtual with override rather than
keeping both?
>
> ---
>
> 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.
>
Seems reasonable to me. Both require a large number of changes, and
are we still changing the indentation style in VTK as I thought we
agreed last year?

Marcus


More information about the vtk-developers mailing list