[vtk-developers] Smart pointer declaration macro?

David Doria daviddoria+vtk at gmail.com
Thu Jan 28 09:47:38 EST 2010


On Thu, Jan 28, 2010 at 9:30 AM, Will Schroeder
<will.schroeder at kitware.com> wrote:
> Wes makes a good point. The other thing that is bothering me about
>
> vtkSmartPointer<vtkClass> myLocal(true);
>
> is that the form of this line of code, if you are not paying attention,
> suggests that the class is being instantiated off of the stack rather than
> heap. In general stack allocation is not allowed in VTK and I don't want
> newbies getting the wrong idea.

I agree with Jeff that one of the main ideas here is to stop the
horrid VTK_CREATE macros that show up because of peoples unwillingness
to write a 2 line variable declaration throughout their code.
Standardizing this will prevent the macros as well as make code more
readable.

I guess it depends on who you want to cater to. Wes, I imagine you
don't mind the 2 line signatures because you're very accustomed to
them. However, every time I show someone new to VTK some code, their
first response is "geez it takes all that just to make a variable!?".
I'd say it could be scaring off new users. I'd imagine most users are
c++ beginners, using VTK as a tool for their trade rather than caring
to be a computer scientist. Actually - are there any statistics on
this? Have there ever been surveys about who is using VTK?

Thanks,

David



More information about the vtk-developers mailing list