Hi, By looking at the CMake source code, there are some inconsistencies regarding coding conventions. This is not a big problem and fixing them probably does not have a high priority. I would like to know what conventions to follow for new code.
Formatting: No longer an issue. A .clang-format is provided and most inconsistencies have disappeared. Braces around single conditional statements: This is currently not consistent. Should they be avoided? Should they be required? We could add the missing ones with clang-tidy. If we want them. Naming conventions: Classes are named cmLikeThis. Member functions and member variables are named LikeThis. Local variables are named likeThis. Members are always accessed with `this->`. So far it is pretty consistent. But how to name free functions and macros? I have seen all kinds of variations. `const T` or `T const` (also: `const T&` or `T const&`): Currently, CMake uses both. I have not analyzed which one dominates. Passing and returning strings: We have `const char*`, `std::string`, and `std::string const&`. Unifying this can affect performance. Storing `const char*` in a `std::string` creates a (potentially unneded) copy (assuming it is not null). `const char*` can distinguish invalid from empty. Do we actually need this distinction? Or should we assume empty==invalid and always prefer `std::string const&` arguments? Or should we introduce a C++17-like cmStringView? cheers, Daniel -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers