X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FCodingStandards.html;h=ee9443d164d5a55284f49b063dfedd4dae7e9e46;hb=9e6d1d1f5034347d237941f1bf08fba5c1583cd3;hp=2fe3bdc9e2bbb1073b9dcf254d1b861a7179a5da;hpb=9eb7e0aa57c189c0b81a291079f7934a039e9f73;p=oota-llvm.git diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html index 2fe3bdc9e2b..ee9443d164d 100644 --- a/docs/CodingStandards.html +++ b/docs/CodingStandards.html @@ -303,7 +303,7 @@ for debate.

In all cases, prefer spaces to tabs in source files. People have different -prefered indentation levels, and different styles of indentation that they +preferred indentation levels, and different styles of indentation that they like... this is fine. What isn't is that different editors/viewers expand tabs out to different tab stops. This can cause your code to look completely unreadable, and it is not worth dealing with.

@@ -419,7 +419,8 @@ 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 to always use the class keyword, unless -all members are public, in which case struct is allowed.

+all members are public and the type is a C++ "POD" type, in which case +struct is allowed.

@@ -490,7 +491,7 @@ most cases, you simply don't need the definition of a class... and not must include all of the header files that you are using -- you can include them either directly or indirectly (through another header file). To make sure that you don't -accidently forget to include a header file in your module header, make sure to +accidentally forget to include a header file in your module header, make sure to include your module header first in the implementation file (as mentioned above). This way there won't be any hidden dependencies that you'll find out about later...

@@ -789,7 +790,7 @@ locality.

Use the "assert" function to its fullest. Check all of your -preconditions and assumptions, you never know when a bug (not neccesarily even +preconditions and assumptions, you never know when a bug (not necessarily even yours) might be caught early by an assertion, which reduces debugging time dramatically. The "<cassert>" header file is probably already included by the header files you are using, so it doesn't cost anything to use @@ -989,12 +990,14 @@ library. There are two problems with this:

Note that using the other stream headers (<sstream> for -example) is allowed normally, it is just <iostream> that is -causing problems.

- -

In addition, new code should always -use raw_ostream or -the llvm::MemoryBuffer API (for reading in files).

+example) is not problematic in this regard (just <iostream>). +However, raw_ostream provides various APIs that are better performing for almost +every use than std::ostream style APIs, so you should just use it for new +code.

+ +

New code should always +use raw_ostream for writing, or +the llvm::MemoryBuffer API for reading files.