Skip to content
Snippets Groups Projects
Unverified Commit 477c4eda authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Update CPPStandards.rst

Remove out of date statement
parent 7b2878bb
No related branches found
No related tags found
No related merge requests found
...@@ -280,20 +280,16 @@ Expressions and Statements ...@@ -280,20 +280,16 @@ Expressions and Statements
with side effects as the right-operand of ``&&`` or ``||``. Any such with side effects as the right-operand of ``&&`` or ``||``. Any such
instances must be commented in detail to alert other developers to instances must be commented in detail to alert other developers to
the fact that the function is not always called. the fact that the function is not always called.
4. ``for`` and ``while`` loops should not use ``break`` and 4. A ``for`` loop should only have one control variable, and should
``continue`` where they can be avoided. Where they are required,
comments should draw attention to them as an alternative exit point
from the loop.
5. A ``for`` loop should only have one control variable, and should
not modify it in the body. not modify it in the body.
6. ``switch`` statements must include a ``default`` clause, even if 5. ``switch`` statements must include a ``default`` clause, even if
only to catch errors. only to catch errors.
7. Each ``case`` of a ``switch`` statement must either end with a 6. Each ``case`` of a ``switch`` statement must either end with a
``break``/``return``, or contain a clear comment to alert other ``break``/``return``, or contain a clear comment to alert other
developers to the fact that execution will fall through to the next developers to the fact that execution will fall through to the next
case. Multiple ``case`` labels (with no code between them) are, case. Multiple ``case`` labels (with no code between them) are,
however, permitted for the same block of code. however, permitted for the same block of code.
8. ``goto`` must be avoided. When there is a need to break out of two 7. ``goto`` must be avoided. When there is a need to break out of two
or more nested loops in one go, the loops should be moved to a or more nested loops in one go, the loops should be moved to a
separate function where 'return' can be used instead. separate function where 'return' can be used instead.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment