[vtk-developers] Smart pointer declaration macro?

David Gobbi david.gobbi at gmail.com
Thu Jan 28 12:25:19 EST 2010


This is reply mainly to Brad about vtkLocalPointer<vtkClass>.

I'm not quite sure why having a smart pointer declaration do a
allocation is such a bad thing, as long as it is explicit that an
object is being allocated.  How about if we make the allocation
explicit in the name of the template, e.g.

4. vtkNew<vtkClass> object;

I know that it appears that the object is being created on the stack,
but that shouldn't be an issue because the stl container classes use
heap allocation, too.

   David


On Thu, Jan 28, 2010 at 9:49 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> I always break the smartpointer line.
>  vtkSmartPointer<vtkImageRectilinearWipe> wipe =
>    vtkSmartPointer<vtkImageRectilinearWipe>::New();
>  wipe->SetInput(0,pad1->GetOutput());
>  wipe->SetInput(1,pad2->GetOutput());
>  wipe->SetPosition(100,256);
>  wipe->SetWipe(wipeMode);
>
> I think it looks OK and does not take up much room.
>
> On Thu, Jan 28, 2010 at 11:41 AM, Francois Bertel
> <francois.bertel at kitware.com> wrote:
>> I'm strongly opposed changing the max line length.
>>
>> I often have two or three xemacs windows open at the time to compare
>> different source files or source file versions and increasing the line
>> length will make it harder. This is the useful also with other source
>> file comparison mode, like vimdiff. It also enforce developers to be
>> succinct. I can probably find ten other reasons to keep the limit that
>> way.
>>
>> On Thu, Jan 28, 2010 at 11:32 AM, Sean McBride <sean at rogue-research.com> wrote:
>>> On 1/28/10 10:09 AM, David Cole said:
>>>
>>>>The fact that we disallow abbreviations by convention means that we will end
>>>>up with long names. It would be better to leave things as they are and
>>>>everybody get over the "waa waa this name is too long" syndrome.
>>>
>>> Another thought, which I'm not necessary advocating, but thought should
>>> be mentioned: increase max line length from 80 to something higher.  80
>>> chars is what my Apple II maxed out at, it seems a bit low for today's
>>> monitors.
>>>
>>>
>>> On 1/28/10 10:32 AM, David E DeMarle said:
>>>
>>>>Do any of the above options allow intellisense and similar code
>>>>completion tools to expose the pointed to class's method/members?
>>>
>>> Similarly, would any of the proposed forms make identifying leaks by
>>> line number harder?  Would valgrind any similar tools still be able to
>>> identify a leak as being on line 123?
>>>
>>> --
>>> ____________________________________________________________
>>> 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
>>>
>>>
>>
>>
>>
>> --
>> François Bertel, PhD  | Kitware Inc. Suite 204
>> 1 (518) 371 3971 x113 | 28 Corporate Drive
>>                      | Clifton Park NY 12065, USA
>> _______________________________________________
>> 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
>
>



More information about the vtk-developers mailing list