From 4ad6d61cb71fca7161dc38339ce29f4d776b2519 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 9 Dec 2006 01:35:43 +0000 Subject: [PATCH] Fixed some formatting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32392 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/CodingStandards.html | 51 ++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html index 72ca77535d4..5b65fbc637c 100644 --- a/docs/CodingStandards.html +++ b/docs/CodingStandards.html @@ -49,7 +49,7 @@
  • Assert Liberally
  • Do not use 'using namespace std'
  • Provide a virtual method anchor for - clases in headers
  • + classes in headers
  • Prefer Preincrement
  • Avoid std::endl
  • @@ -616,42 +616,43 @@ assert(isa<PHINode>(Succ->front()) && "Only works on PHId BBs!"
    - Do not use 'using namespace std' + Do not use 'using namespace std'

    In LLVM, we prefer to explicitly prefix all identifiers from the standard -namespace with an "std::" prefix, rather than rely on "using namespace std;". -

    +namespace with an "std::" prefix, rather than rely on +"using namespace std;".

    -

    In header files, adding a 'using namespace XXX' directive pollutes the -namespace of any source file that includes the header. This is clearly a bad -thing.

    +

    In header files, adding a 'using namespace XXX' directive pollutes +the namespace of any source file that includes the header. This is clearly a +bad thing.

    -

    In implementation files (e.g. .cpp files) the rule is more of a stylistic -rule, but is still important. Basically, using explicit namespace prefixes -makes -the code more clear - because it is immediately obvious what facilities -are being used and where they are coming from - and more portable - -because namespace clashes cannot occur between LLVM code and other namespaces. -The portability rule is important because different standard library -implementations expose different symbols (potentially ones they shouldn't) and -future revisions to the C++ standard will add more symbols to the std -namespace. As such, we never 'using namespace std;' in LLVM.

    +

    In implementation files (e.g. .cpp files), the rule is more of a stylistic +rule, but is still important. Basically, using explicit namespace prefixes +makes the code clearer, because it is immediately obvious what facilities +are being used and where they are coming from, and more portable, because +namespace clashes cannot occur between LLVM code and other namespaces. The +portability rule is important because different standard library implementations +expose different symbols (potentially ones they shouldn't), and future revisions +to the C++ standard will add more symbols to the std namespace. As +such, we never use 'using namespace std;' in LLVM.

    -

    The exception to the general rule (i.e. it's not an exception for the std -namespace) is for implementation files. For example, all of the code in the -LLVM project implements code that lives in the 'llvm' namespace. As such, it -is ok, and actually more clear, for the .cpp files to have a 'using namespace -llvm' directive at their top, after the #includes. The general form of this -rule is that any .cpp file that implements code in any namespace may use that -namespace (and its parents), but should not use any others.

    +

    The exception to the general rule (i.e. it's not an exception for +the std namespace) is for implementation files. For example, all of +the code in the LLVM project implements code that lives in the 'llvm' namespace. +As such, it is ok, and actually clearer, for the .cpp files to have a 'using +namespace llvm' directive at their top, after the #includes. The +general form of this rule is that any .cpp file that implements code in any +namespace may use that namespace (and its parents'), but should not use any +others.

    - Provide a virtual method anchor for clases in headers + Provide a virtual method anchor for classes + in headers