<div dir="ltr">+1! ... actually: ++1 :-)<div><br></div><div>I would support this. To keep VTK relevant we need to be introducing these features. Especially features like nullptr, unique_ptr etc.<div><br></div><div>But I would not be happy at introducing more VTK defines like VTK_OVERRIDE and VTK_FINAL - unless absolutely necessary. I much prefer Sean's idea of using a modernise tool.</div>
<div><br></div><div>Regards<br></div><div>   Andrew<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 19, 2014 at 7:05 AM,  <span dir="ltr"><<a href="mailto:vtk-developers-request@vtk.org" target="_blank">vtk-developers-request@vtk.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>---------- Forwarded message ----------<br>From: "Marcus D. Hanwell" <<a href="mailto:marcus.hanwell@kitware.com">marcus.hanwell@kitware.com</a>><br>
To: VTK Developers <<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a>><br>Cc: <br>Date: Mon, 18 Aug 2014 13:45:37 -0400<br>Subject: [vtk-developers] Introducing (optional) C++11 features in VTK<br>Hi,<br>

<br>
As we move forward, it would be great to get a feeling for people's<br>
thoughts about integrating some components of C++11 optionally. So if<br>
C++11 is available/enabled, there are several features we could enable<br>
optionally at compile time.<br>
<br>
A very simple example is that of the new override keyword, that is<br>
used to indicate that a member function is overriding a virtual<br>
function. Using this can avoid mistakes where the signature changes<br>
and derived classes are missed. It can be defined in a header (empty<br>
on old compilers, override with recent compilers). Final is similar,<br>
indicating that the virtual function cannot be overridden in derived<br>
classes.<br>
<br>
This would introduce changes to the VTK coding style, where we now use<br>
virtual for all virtual functions (first declaration, or subsequent<br>
overrides). We could introduce this gradually for new code, even<br>
having one or two dashboards compiling this way would help spot simple<br>
errors such as an incorrect signature not actually overriding a<br>
function, but in fact declaring a new virtual for example.<br>
<br>
In these cases I would suggest simple naming, so VTK_OVERRIDE and<br>
VTK_FINAL would be used where a C++11 only code would simply use the<br>
new keywords.<br>
<br>
Thoughts, objections? There are lots of other features, and I know it<br>
will be a while before we can use them all but it would be great to<br>
make a start with some of the easier ones that can improve code<br>
quality with little overhead.<br>
<br>
Marcus<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: Ben Boeckel <<a href="mailto:ben.boeckel@kitware.com">ben.boeckel@kitware.com</a>><br>To: "Marcus D. Hanwell" <<a href="mailto:marcus.hanwell@kitware.com">marcus.hanwell@kitware.com</a>><br>
Cc: VTK Developers <<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a>><br>Date: Mon, 18 Aug 2014 14:21:56 -0400<br>Subject: Re: [vtk-developers] Introducing (optional) C++11 features in VTK<br>On Mon, Aug 18, 2014 at 13:45:37 -0400, Marcus D. Hanwell wrote:<br>

> Thoughts, objections? There are lots of other features, and I know it<br>
> will be a while before we can use them all but it would be great to<br>
> make a start with some of the easier ones that can improve code<br>
> quality with little overhead.<br>
<br>
What about "= delete" for removing default assignment and copy<br>
constructors?<br>
<br>
--Ben<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: "Marcus D. Hanwell" <<a href="mailto:marcus.hanwell@kitware.com">marcus.hanwell@kitware.com</a>><br>To: Ben Boeckel <<a href="mailto:ben.boeckel@kitware.com">ben.boeckel@kitware.com</a>><br>
Cc: VTK Developers <<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a>><br>Date: Mon, 18 Aug 2014 14:29:10 -0400<br>Subject: Re: [vtk-developers] Introducing (optional) C++11 features in VTK<br>On Mon, Aug 18, 2014 at 2:21 PM, Ben Boeckel <<a href="mailto:ben.boeckel@kitware.com">ben.boeckel@kitware.com</a>> wrote:<br>

> On Mon, Aug 18, 2014 at 13:45:37 -0400, Marcus D. Hanwell wrote:<br>
>> Thoughts, objections? There are lots of other features, and I know it<br>
>> will be a while before we can use them all but it would be great to<br>
>> make a start with some of the easier ones that can improve code<br>
>> quality with little overhead.<br>
><br>
> What about "= delete" for removing default assignment and copy<br>
> constructors?<br>
><br>
Certainly, I think we should start out simple and then build it out.<br>
If we have prototypes for a few of the most useful features that can<br>
easily be encapsulated in compile time logic that will degrade to<br>
C++98 that would be great.<br>
<br>
Marcus<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: "Sean McBride" <<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>><br>To: "Marcus D. Hanwell" <<a href="mailto:marcus.hanwell@kitware.com">marcus.hanwell@kitware.com</a>>, "VTK Developers" <<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a>><br>
Cc: <br>Date: Mon, 18 Aug 2014 16:50:12 -0400<br>Subject: Re: [vtk-developers] Introducing (optional) C++11 features in VTK<br>On Mon, 18 Aug 2014 13:45:37 -0400, Marcus D. Hanwell said:<br>
<br>
>As we move forward, it would be great to get a feeling for people's<br>
>thoughts about integrating some components of C++11 optionally. So if<br>
>C++11 is available/enabled, there are several features we could enable<br>
>optionally at compile time.<br>
<br>
+1 from me.<br>
<br>
nullptr is another one that can be made to work even on older compilers with some #define glue.<br>
<br>
Instead of creating a 'VTK_OVERRIDE', we could also use 'override' as if we required C++11 and "#define override /* nothing */" as appropriate.  Then when C++11 really is the minimun requirement no big find/replace is required.  Just a thought.<br>

<br>
PS: I already have dashboards building as C++11 and C++14.<br>
<br>
Cheers,<br>
<br>
--<br>
____________________________________________________________<br>
Sean McBride, B. Eng                 <a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a><br>
Rogue Research                        <a href="http://www.rogue-research.com" target="_blank">www.rogue-research.com</a><br>
Mac Software Developer              Montréal, Québec, Canada<br>
<br>
<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: "Sean McBride" <<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>><br>To: "Marcus D. Hanwell" <<a href="mailto:marcus.hanwell@kitware.com">marcus.hanwell@kitware.com</a>>, "VTK Developers" <<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a>><br>
Cc: <br>Date: Mon, 18 Aug 2014 17:05:38 -0400<br>Subject: Re: [vtk-developers] Introducing (optional) C++11 features in VTK<br>On Mon, 18 Aug 2014 16:50:12 -0400, Sean McBride said:<br>
<br>
>nullptr is another one that can be made to work even on older compilers<br>
>with some #define glue.<br>
><br>
>Instead of creating a 'VTK_OVERRIDE', we could also use 'override' as if<br>
>we required C++11 and "#define override /* nothing */" as appropriate.<br>
>Then when C++11 really is the minimun requirement no big find/replace is<br>
>required.  Just a thought.<br>
<br>
I hit send too fast...<br>
<br>
I also wanted to suggest looking at the clang-modernize tool, which is "a standalone tool used to automatically convert C++ code written against old standards to use features of the newest C++ standard".<br>
<br>
<<a href="http://clang.llvm.org/extra/clang-modernize.html" target="_blank">http://clang.llvm.org/extra/clang-modernize.html</a>><br>
<br>
Specifically, it can be used to automatically add 'override' and convert to 'nullptr':<br>
<br>
<<a href="http://clang.llvm.org/extra/AddOverrideTransform.html" target="_blank">http://clang.llvm.org/extra/AddOverrideTransform.html</a>><br>
<<a href="http://clang.llvm.org/extra/UseNullptrTransform.html" target="_blank">http://clang.llvm.org/extra/UseNullptrTransform.html</a>><br>
<br>
Cheers,<br>
<br>
--<br>
____________________________________________________________<br>
Sean McBride, B. Eng                 <a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a><br>
Rogue Research                        <a href="http://www.rogue-research.com" target="_blank">www.rogue-research.com</a><br>
Mac Software Developer              Montréal, Québec, Canada<br>
<br>
<br></blockquote></div>-- <br>___________________________________________<br>Andrew J. P. Maclean<br><br>___________________________________________
</div></div></div></div>