[vtk-developers] vtkNew in examples (or auto?)

Andras Lasso lasso at queensu.ca
Mon Jun 26 19:34:41 EDT 2017


Thanks for all the comments on this topic. I've updated the pull request (squashed commits, included main points from the discussions):

https://gitlab.kitware.com/lassoan/vtk/commit/00bf5f3d3acf655e396feb4d3b7167806aba05b9

Andras

-----Original Message-----
From: vtk-developers [mailto:vtk-developers-bounces at vtk.org] On Behalf Of Marcus D. Hanwell
Sent: Monday, June 26, 2017 9:47 PM
To: David Cole <DLRdave at aol.com>
Cc: VTK Developers <vtk-developers at vtk.org>; Brad King <brad.king at kitware.com>
Subject: Re: [vtk-developers] vtkNew in examples (or auto?)

On Mon, Jun 26, 2017 at 3:30 PM, David Cole <DLRdave at aol.com> wrote:
> I hereby retract my "disastrous" comment from the other email thread 
> on this topic...
>
That was quite a thread, it was hidden by a terrible subject that gave me no idea what it was about. I think I was with you, but as vtkObject derived classes are all reference counted, and vtkSmartPointer/vtkNew are effectively the same as far as risk of going out of scope/returning a dangling pointer we should be consistent.

I am not a fan of either implicitly converting, but if one does it they both should. I was just being cautious at the time, but I think it was the wrong call, and would prefer consistency. I routinely use vtkSmartPointer and vtkNew in class design to take care of objects, and when switching between the two it is a pain because of the inconsistency.

I had been planning to propose this patch for a while, and am glad someone else did. It is a simple change, but it makes using the two far more interchangeable, and will hopefully encourage more people to use our pointer classes to aid with memory management, and banish the smart pointer creation macros littering tests.
_______________________________________________
Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=8qrELn4ovJgQN7AjOI8E3FDzrU%2FudajhRDLyeUpCoYg%3D&reserved=0

Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=j%2BaQLKquqzpFouD%2BxG0Mu%2FK7vDiyhWkVy2AcH2y8whE%3D&reserved=0

Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=6XZzGlIeDboJvRDMokX422KvtmCrIltQtXD4vRE20bY%3D&reserved=0

Follow this link to subscribe/unsubscribe:
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=3Mffbxh0OuhI%2FEd83nrkhyOelfKcmG1pq99WstkE1Vw%3D&reserved=0



More information about the vtk-developers mailing list