mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-18 13:10:17 -06:00
Help/dev: Improve coding conventions guide
Improve the coding conventions specified in our source code guide: - Recommend capitalization for locals as well as members. - Remove exceptions for `const` placement; new code should always prefer "east" style. - Remove separate section; "Code Style" and "Code Conventions" are similar enough to not need to make a distinction.
This commit is contained in:
@@ -20,20 +20,16 @@ format only a subset of files, such as those that are locally modified.
|
||||
.. _`.clang-format`: ../../.clang-format
|
||||
.. _`Utilities/Scripts/clang-format.bash`: ../../Utilities/Scripts/clang-format.bash
|
||||
|
||||
C++ Code Conventions
|
||||
====================
|
||||
In addition, we have a few coding conventions that we prefer for new code to
|
||||
follow (which are not enforced by other tooling):
|
||||
|
||||
We loosely follow a few coding conventions:
|
||||
* Name local variables using ``camelCase``.
|
||||
|
||||
* Name class members using ``CamelCase``.
|
||||
* Name class members and free functions using ``PascalCase``.
|
||||
|
||||
* Reference class members using ``this->Member``.
|
||||
|
||||
* Use east ``const`` style, e.g., ``int const`` instead of ``const int``.
|
||||
Exceptions:
|
||||
|
||||
* C strings: ``const char*``
|
||||
* Global constants: ``static const ...``
|
||||
|
||||
* Declare variables using a locally-specified type:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user