Skip to content

ENH: C++11 modernize NULL and 0 to nullptr.

ITK5.0 uses c++11 nullptr instead of NULL and 0. I was getting errors explained here:

error: call to 'a' is ambiguous

STEPs to use clang-tidy: Generate compile_commands.json with CMake option: -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON. This generates a compile_commands.json in your build directory at configure time.

install clang and clang tools, that includes clang-tidy and (In Archlinux: sudo pacman -S clang, in other systems might be clang-extra-tools or similar) Docs:

And in the build folder of slicer, execute: -header-filter='.*' -checks='-*,modernize-use-nullptr' -fix

This will iteratively check files for updates. It takes a while. The sources are only modified at the end of the process, so you could cancel anytime before with no consequences.

Issue in Mantis:

Merge request reports