From 7348985ca2499668f44dd607f59a968105613bf3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 8 Oct 2024 12:35:52 +1100 Subject: [PATCH] C/C++ Code Style Update enum naming conventions text. --- docs/handbook/guidelines/c_cpp.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/handbook/guidelines/c_cpp.md b/docs/handbook/guidelines/c_cpp.md index dfe91a1b..635c8499 100644 --- a/docs/handbook/guidelines/c_cpp.md +++ b/docs/handbook/guidelines/c_cpp.md @@ -99,7 +99,19 @@ int64_t size() const {...} ### Enums -- Labels in enums should be in all capitals. +- Enum type names should avoid being confused with related structs or classes. + + Recommended suffixes include: + + - `Type` & `Mode` for discrete values. + - `Flag` & `Mask` for values which are treated as bit-masks. + + However these are guidelines which may be applied selectively. + Terms such as `Direction`, `Stage`, `Code` & `Method` (among others) are + sufficiently descriptive not to require one of the recommended suffixes. + +- C style enum labels in enums should be in all capitals. +- C++ style enums labels which use `enum class` should use pascal-case. - Enums used in DNA files should have explicit values assigned. ### Function arguments -- 2.30.2