[vtk-developers] Introducing (optional) C++11 features in VTK

Andrew Maclean andrew.amaclean at gmail.com
Sat Aug 23 02:35:02 EDT 2014


Just did a bit of digging around in the Microsoft documentation and it
seems VS2012 and VS2013 support final, override and nullptr.

There is a lot of info and tables here:
http://msdn.microsoft.com/en-us/library/hh567368.aspx

final: VS2012/2013
overrride: VS2012/2013
nullptr VS2010/2013

So you can probably allow their use for these compilers in VTK. Probably
somewhere in vtkCompilerExtras.cmake and vtkWin32Header.h.

Actually there is CMAKE_CXX_COMPILER_ID, CMAKE_CXX_COMPILER_VERSION
available but I am not sure it
was accessible in cmake 2.8.8 (the minimum for VTK).
For VS2013 I get Compiler ID/Version: MSVC 18.0.30723.0 (however I am using
CMake 3.1).
CMAKE_CXX_COMPILER_ID returns at least one of "GNU", "MSVC", "Clang".

Andrew


Andrew



Andrew




On Sat, Aug 23, 2014 at 7:21 AM, Sean McBride <sean at rogue-research.com>
wrote:

> On Fri, 22 Aug 2014 13:25:54 -0400, Marcus D. Hanwell said:
>
> >> 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...
> >
> >I doubt we have many, as we normally make people fix these in review
> >and they cause failures on Windows for example.
>
> So I built with clang and "-std=c++11 -stdlib=libc++ -pedantic
> -Wno-extra-semi" and there were only a few warnings:
>
> a) 15 of the form:
>
> VTK/Filters/General/vtkYoungsMaterialInterface.cxx:2568:5: warning:
> variable length arrays are a C99 feature [-Wvla-extension]
>     ALLOC_LOCAL_ARRAY( derivatives, REAL2, nv-1 );
>     ^
> VTK/Filters/General/vtkYoungsMaterialInterface.cxx:2201:49: note: expanded
> from macro 'ALLOC_LOCAL_ARRAY'
> #define ALLOC_LOCAL_ARRAY(name,type,n) type name[(n)]
>                                                 ^
>
> This works in Windows as there is a malloc fallback case.
>
>
>
> b) 3 of the form:
>
> VTK/Rendering/Label/vtkLabelHierarchy.cxx:887:10: warning: reference
> cannot be bound to dereferenced null pointer in well-defined C++ code;
> pointer may be assumed to always convert to true
> [-Wundefined-bool-conversion]
>   if ( &(this->Node->value()) )
>   ~~    ~^~~~~~~~~~~~~~~~~~~~
> VTK/Utilities/octree/octree_node.h:48:13: note: 'value' returns a reference
>   reference value() { return this->_M_data; }
>             ^
>
> Cheers,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
>


-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20140823/f4676e6b/attachment-0002.html>


More information about the vtk-developers mailing list