diff --git a/llvm/docs/CodingStandards.html b/llvm/docs/CodingStandards.html index 3a7f8b3d1e9a..a99e46e5b580 100644 --- a/llvm/docs/CodingStandards.html +++ b/llvm/docs/CodingStandards.html @@ -623,6 +623,29 @@ assert(isa<PHINode>(Succ->front()) && "Only works on PHId BBs!"
You get the idea...
+Please be aware when adding assert statements that not all compilers are aware of +the semantics of the assert. In some places, asserts are used to indicate a piece of +code that should not be reached. These are typically of the form:
+ ++assert(0 && "Some helpful error message"); ++
When used in a function that returns a value, they should be followed with a return +statement and a comment indicating that this line is never reached. This will prevent +a compiler which is unable to deduce that the assert statement never returns from +generating a warning.
+ ++assert(0 && "Some helpful error message"); +// Not reached +return 0; ++