TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C++ Coding Standard
Search

Rule:  CFL#014Checked automatically with code checker

Synopsis:Do not use multiple return statements
Language:C++
Severity Level:9
Category:Control Flow


Description:

If this rule is followed, the complications of [CFL#020] are avoided. There are 2 exceptions to this rule. Multiple returns are allowed in case of:

  • precondition checks that fail at the beginning of a function
  • loops that should terminate as soon as some condition is met (e.g. return the first element larger than 10 in a list)