[vtk-developers] Introducing (optional) C++11 features in VTK
Sean McBride
sean at rogue-research.com
Fri Aug 22 13:15:39 EDT 2014
Marcus,
First, thanks for working on this!
I realize you are just testing things out, but some comments nonetheless:
On Fri, 22 Aug 2014 11:57:56 -0400, Marcus D. Hanwell said:
>So my first pass at this, keeping the bar relatively low for now,
>
>http://review.source.kitware.com/#/t/4550/
>
>I have tested this both as default, and forcing to ANSI C++, on GCC
>4.9.1. It would be pretty simple to extend this for Clang (I would
>rather do it in a follow up commit).
I think the term "ANSI C++" is horribly ambiguous, and shouldn't be used (ex: VTK_FORCE_ANSI_CXX). Honestly, I'm not even sure what you mean by it. Do you mean C++98?
The string "ANSI" doesn't even appear on the wikipedia C++ page: :)
<http://en.wikipedia.org/wiki/C%2B%2B>
Better to use these names IMNSHO:
<http://en.wikipedia.org/wiki/C%2B%2B#Standardization>
>This does change the default to
>enable C++11 if the GCC compiler reports it is capable of this
I would argue against forcing any particular dialect. It seems to me that that should be an explicit choice made by the user at compile time. Specially since VTK is a library. If my app is built as C++98 and VTK 6.2 suddenly decides to build itself as C++11 then I could easily get freaky link errors because of changes to mangling, etc.
>verified the VTK_OVERRIDE fails as expected when overriding something
>that is not virtual. When looking at this it raised the question (for
>me at least) of whether we ask for ANSI C++, and the standards (I
>think we should), or the GNU specific extensions (what we were
>implicitly doing before by passing nothing unless extra warnings were
>turned on).
As VTK is cross platform, best to use as few gcc extensions as possible, none ideally.
clang has a warning that warns when gcc extensions are used, as I recall there are a few in the VTK codebase, like using C99 VLAs in C++ files. I'll do a build and see how many warnings pop...
>The features coming up in CMake look great, but I don't think we need
>to wait in order to use some of the simpler features.
Agreed.
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the vtk-developers
mailing list