[vtk-developers] Dashboard failures, vtkSetNGetMacro

George Zagaris george.zagaris at kitware.com
Tue Mar 26 08:17:15 EDT 2013


The reasoning for adding this was because I needed to use something like a
Get/Set with vtkAMRBox which is a light-weight object and does not inherit
from vtkObject. As you mentioned, this was added before the gerrit workflow
was in place and therefore did not go through the normal review process,
which would have caught any issues.

That said, I don't have any use for the vtkSetNGetMacro anymore and I don't
think vtkAMRBox uses that any longer. I am agnostic as to whether you
remove it or not.


On Mon, Mar 25, 2013 at 11:05 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi All,
>
> I clicked on a dashboard compile error today and saw something that
> was like finding a cockroach in my salad.
>
> A new macro.
>
> Someone snuck a new macro called vtkSetNGetMacro into vtkSetGet.h.
>
> I won't go into the reasons why macros are bad.  Every C++ programmer
> already knows.  In VTK, we generally try to keep our macros caged in
> a little file called vtkSetGet.h where they have sat mostly unchanged
> for a dozen years.  We don't let our macros breed.
>
> Here are problems with vtkSetNGetMacro:
>
> 1) It isn't, as its name suggests, the same as having a SetMacro and
> a GetMacro.  How is it different?  It doesn't call "Modified" on the
> object.  And it's very important for Set methods to call Modified.
> (To be fair, the documentation does state "this macro can be used on
> non-vtkObject classes" but it should also state "this macro should
> _not_ be used on vtkObject-derived classes").
>
> 2) The macros in vtkSetGet.h are hard-coded into the wrappers.  This
> is historical and will eventually be fixed.  But for now, using a new
> macro to define your class interface is likely to make your class
> unwrappable.
>
> 3) The biggest problem, however, it is that it is a new macro, and if
> people plan to add new macros, I think they should check with Berk,
> Brad, or Will first.
>
>  - David
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130326/66d8267f/attachment.html>


More information about the vtk-developers mailing list