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

Sean McBride sean at rogue-research.com
Fri Aug 22 17:21:42 EDT 2014


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





More information about the vtk-developers mailing list