From dc5b80882e71347955720dbe4528f6a5ba67da19 Mon Sep 17 00:00:00 2001 From: Lev Dragunov Date: Wed, 16 Dec 2015 13:09:39 +0300 Subject: [PATCH] Styleguide tacit agreements. --- docs/CPP_STYLE.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/CPP_STYLE.md b/docs/CPP_STYLE.md index e9fa1646e9..d69a07523e 100644 --- a/docs/CPP_STYLE.md +++ b/docs/CPP_STYLE.md @@ -25,7 +25,8 @@ Naming and formatting - Space after the keyword in conditions and loops. Space after `;` in `for` loop. - Space between binary operators: `x = y * y + z * z`. - Space after double dash. -- Compile-time constants must be named in camelCase, starting with a lower-case `k`, e.g. `kCompileTimeConstant`. +- We use `using` keyword instead of `typedef`. +- Compile-time constants must be named in camelCase, starting with a lower-case `k`, e.g. `kCompileTimeConstant` and marked as `constexpr` when possible. - Values of enum classes must be named in CamelCase, e.g. `enum class Color { Red, Green, LightBlue };`. - Macros and C-style enums must be named in UPPER_CASE, and enum values must be prefixed with a capitalized enum name. @@ -48,7 +49,7 @@ To automatically format a file, install `clang-format` and run: #include "std/math.hpp" -uint16_t const kBufferSize = 255; +uint16_t constexpr kBufferSize = 255; // C-style enums are ALL_CAPS. But remember that C++11 enum classes are preferred. enum Type @@ -58,7 +59,7 @@ enum Type TYPE_STRING }; -typedef double TMyTypeStartsWithCapitalTLetter; +using TMyTypeStartsWithCapitalTLetter = double; class ComplexClass {