[vtk-developers] Implicit copy constructors in VTK

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Wed Jul 24 11:55:13 EDT 2013


Would it make sense to provide a VTK_DISABLE_COPY() macro ?  (Similar to
what is done within Qt with Q_DISABLE_COPY [1])

[1] http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#Q_DISABLE_COPY

On Wed, Jul 24, 2013 at 11:48 AM, Marcus D. Hanwell <
marcus.hanwell at kitware.com> wrote:

> I agree with Rob, and can take care of putting a patch together for
> the classes you call out. The rules outlined only make sense for
> vtkObject derived classes, we should provide clear guidelines for
> those that are not part of that hierarchy too.
>
> On Wed, Jul 24, 2013 at 11:06 AM, Robert Maynard
> <robert.maynard at kitware.com> wrote:
> > The VTK coding standards should be amended to state that those rules
> > are only valid for classes that derive from vtkObject.
> >
> > Classes like vtkBond, vtkTuple, vtkBoundingBox all which don't inherit
> > from vtkObject should follow the rule of three and implement the copy
> > and assignment constructor if they implement a destructor.
> >
> > On Wed, Jul 24, 2013 at 10:50 AM, Sean McBride <sean at rogue-research.com>
> wrote:
> >> Hi all,
> >>
> >> So I'm looking at the clang warnings on Rogue7, but need C++ help
> before I can proceed further.  We have two similar warnings, repeated for
> several classes:
> >>
> >> VTK/Common/DataModel/vtkBond.h:30:3: warning: definition of implicit
> copy constructor for 'vtkBond' is deprecated because it has a user-declared
> destructor [-Wdeprecated]
> >>   ~vtkBond();
> >>   ^
> >>
> >> VTK/Common/Math/vtkQuaternion.h:201:8: warning: definition of implicit
> copy constructor for 'vtkQuaternion<float>' is deprecated because it has a
> user-declared copy assignment operator [-Wdeprecated]
> >>   void operator=(const vtkQuaternion<T>& q);
> >>        ^
> >>
> >> From what I can tell, in C++11, the implicit generation of copy
> constructors is now deprecated if 1) you provide a user-declared destructor
> or 2) you provide a user-declared copy assignment operator.
> >> <http://stackoverflow.com/a/11255258>
> >>
> >> So it would seem a solution is to provide an explicit copy constructor,
> but VTK's coding standards gives me pause: "Classes should have protected
> constructors and destructors, and privately declared but unimplemented copy
> constructor and assignment operator. Rationale: VTK’s reference counting
> implementation depends on carefully controlling each object’s reference
> count".
> >>
> >> So now I'm not sure how to proceed...
> >>
> >> Thanks,
> >>
> >> --
> >> ____________________________________________________________
> >> Sean McBride, B. Eng                 sean at rogue-research.com
> >> Rogue Research                        www.rogue-research.com
> >> Mac Software Developer              Montréal, Québec, Canada
> >> _______________________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtk-developers
> >>
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtk-developers
> >
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>


-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130724/6b74a9a8/attachment.html>


More information about the vtk-developers mailing list