diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html index c1e1a1dd90d..8171130e2a2 100644 --- a/docs/CodingStandards.html +++ b/docs/CodingStandards.html @@ -29,6 +29,7 @@
  • Treat Compiler Warnings Like Errors
  • Write Portable Code
  • +
  • Use of class/struct Keywords
  • Style Issues @@ -366,6 +367,23 @@ to support it.

    + +
    +Use of class and struct Keywords +
    +
    +

    In C++ the class and struct keywoards can be used almost + interchangeably. The only difference is when they are used to declare a class: + class makes all members private by default while struct + makes all members public by defaut.

    +

    Unfortunately, not all compilers follow the rules and some will generate + different symbols based on whether class or struct was used + to declare the symbol. This can lead to problems at link time.

    +

    So, the rule for LLVM is this: "always use the class keyword, + unless all members are public in which case struct is + allowed.

    +
    +
    Style Issues