Search code examples
c++clionclang-tidy

C++98, but clang-tidy says use nullptr?


I am using Clion and my project is set to C++98, but clang-tidy has suggestions to use nullptr instead of NULL.

Is there a clang-tidy setting somewhere in the IDE or is it something else?


Solution

  • I don't know CLion specifically but that message is related to the modernize-use-nullptr check which is intended for upgrading old code to use C++11 features. (in this case avoiding inadvertently using the NULL macro in assignment to non-pointer variables since it expands to 0)

    Disable that check if you want to keep your code in C++98.