Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
break is a keyword to
- end a for-loop
- end a while-loop
- end a switch-statement
Consider to never use break, except in switch-statements
or when the alternative would obscure the program's logic [1].
- Joint Strike Fighter Air Vehicle C++ Coding Standards for the System Development and Demonstration Program. Document Number 2RDU00001 Rev C. December 2005. AV Rule 191 (MISRA Rule 58): 'The break statement shall not be used (except to terminate the cases of a switch statement).' and 'Exception: The break statement may be used to 'break' out of a single loop provided the alternative would obscure or otherwise significantly complicate the control logic.'
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.
