[vtk-developers] help with cppcheck duplInheritedMember warnings

Jon Haitz Legarreta jhlegarreta at vicomtech.org
Mon May 8 16:54:58 EDT 2017


Thanks for the explanation Ben.

The MR to fix it is under way.

Kind regards,
JON HAITZ


--


On 8 May 2017 at 14:48, Ben Boeckel <ben.boeckel at kitware.com> wrote:

> On Fri, May 05, 2017 at 18:31:53 +0200, Jon Haitz Legarreta wrote:
> > The ivar being reported as a duplicate is not, in fact, a duplicate: both
> > the parent class vtkChartMatrix and the child vtkScatterPlotMatrix define
> > an internal class named PIMPL. And the ivar "Private" is an instance of
> > that class.
>
> vtkChartMatrix is doing PIMPL wrong. It is `protected`, not `private`. I
> think that is likely the proper fix.
>
> > I was not aware of the use of private implementations that PIMPL
> represents
> > within the VTK context.
>
> Usually, I've seen `<classname>Internal` instead declared outside of the
> class itself, but these are usually `protected` so that subclasses can
> use them. If `vtkChartMatrix::Private` has this intended use, it should
> follow that pattern instead.
>
> > BTW, I'm interested in knowing about the (need of/convenience) PIMPL
> > classes. Is the use of such PIMPL classes documented somewhere?
>
> In VTK? I don't think so. The idea is to hide the amount of data
> necessary for completely internal data collection out of the header and
> affecting `sizeof(class)` (an ABI break) or exposing too much (prone to
> breaking API because users of the class rely on the wrong things). The
> Wiki page is useful:
>
>     https://en.wikipedia.org/wiki/Opaque_pointer
>
> --Ben
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170508/123ce543/attachment.html>


More information about the vtk-developers mailing list