[vtk-developers] VTK C++11 compatibility

Sean McBride sean at rogue-research.com
Mon Mar 19 19:13:09 EDT 2012


Hi all,

So I tried to build VTK as C++11 with clang by passing the -std=c++11 flag.  There are a few dozen compiler errors, almost all of the same kind, ex: 

/VTK/Filtering/vtkCellTreeLocator.cxx:654:27: warning: non-constant-expression cannot be narrowed from type 'double' to 'float' in initializer list in C++11 [-Wc++11-narrowing]
  const float _pos[3] = { pos[0], pos[1], pos[2] };
                          ^~~~~~

They'll appear on one of my dashboard builds tomorrow (as warnings, not errors).

The sledgehammer solution would be to add a bunch of casts.  In some cases, there may be better solutions, ex: perhaps the above implicit double->float truncation is unfinished work from the major float->double transition years ago?

I'm working on a patch that fixes ones that seem trivial enough (considering most warnings fall in code I'm not at all familiar with).... after that, I'm hoping the rest of you can pitch in.... :)

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