]> granicus.if.org Git - icu/commitdiff
ICU-21050 add detail for when need to ifndef C++ boilerplate
authorMarkus Scherer <markus.icu@gmail.com>
Mon, 1 Feb 2021 22:48:06 +0000 (14:48 -0800)
committerMarkus Scherer <markus.icu@gmail.com>
Mon, 8 Feb 2021 23:27:03 +0000 (15:27 -0800)
docs/userguide/dev/codingguidelines.md

index a41189879bb5fbc8f1bbdbe8a238ea40522da45e..9cd78846595a8be9b07af74e834d00f8197cc604 100644 (file)
@@ -295,8 +295,12 @@ We do not `#ifndef` APIs where that would be problematic:
   struct/class fields, virtual methods)
 * enum constants where that would modify the numeric values of following
   constants
-* C++ class boilerplate (e.g., default/copy constructors) because otherwise
-  the compiler would create public ones
+  * actually, best to use `#ifndef` together with explicitly defining the
+    numeric value of the next constant
+* C++ class boilerplate (e.g., default/copy constructors), if
+  the compiler would auto-create public functions to replace `#ifndef`’ed ones
+  * For example, the compiler automatically creates a default constructor if
+    the class does not specify any other constructors.
 * private class members
 * definitions in internal/test/tools header files (that would be pointless;
   they should probably not have API tags in the first place)