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

Elvis Stansvik elvis.stansvik at orexplore.com
Tue Jun 27 02:42:30 EDT 2017


Den 27 juni 2017 1:34 fm skrev "Andras Lasso" <lasso at queensu.ca>:
>
> Thanks for all the comments on this topic. I've updated the pull request
(squashed commits, included main points from the discussions):

Thanks a lot for taking care of this.

Now, my original post was about the examples. Those will naturally not be
updated to take care of this brand new functionality, since they need to
work with older VTKs.

However, regarding the auto keyword for declarations (but keeping the use
of vtkSmartPointer intact): The objection to that was older compilers, but
auto has been supported in all major compilers since 2010.

I'd like to get some more opinions on this. Personally I think compilers
lacking auto is so rare that the improved readability of the examples
outweigh the inconvenience of those who use old compilers (who will have to
adapt the examples).

Should we have a poll on this, like was done for vtkNew implicit conversion?

Elvis

>
>
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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170627/5cd9c830/attachment-0001.html>


More information about the vtk-developers mailing list