Details
-
Improvement
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
Description
C-style casts are, for very good reasons, prohibited by our coding guidelines (see http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Casting), yet they are pervasive in our codebase.
There is a compiler flag, -Wold-style-casts, that can be used to prohibit their usage. However, we cannot enable that flag until we remove all of the existing C-style casts.
To do so, we either need to
- Use a linter that can detect them, like clang-tidy, and fix them up manually.
- Write a clang tool that does source to source transformations and re-writes the C style casts to the appropriate C++ style cast.
To make -Wold-style-casts effective, we will probably also need to figure out how to make the compiler consider headers coming from src/third_party to be 'system' headers, for which warnings are not issued. We probably want to do this anyway since we frequently encounter warnings in third_party code. Currently, we end up doing global suppressions for those warnings, but we would not need to do so if we treated src/third_party as a system header.