User Tools

Site Tools


guides:programstyle:goto

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
guides:programstyle:goto [2020/08/04 15:08] – [continue] wikiadminguides:programstyle:goto [2022/08/02 11:59] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 All of these statements change the flow of control in a c++ program.  They change the behavior of control structures and therefore make it more difficult to understand the final flow of control in a program.  For these reasons, the use of these statements is heavily restricted. All of these statements change the flow of control in a c++ program.  They change the behavior of control structures and therefore make it more difficult to understand the final flow of control in a program.  For these reasons, the use of these statements is heavily restricted.
 +
 +===== Summary =====
 +
 +  * Do not use continue statements
 +  * Do not use goto statements
 +  * Only use break statements in switch statements
 +  * Only use a single return statement per function. It must be the last statement in the function.
 +  * All functions should have a return statement.
  
 ===== goto ===== ===== goto =====
  
 +The use of a goto statement transfers code to a predefined location in the program.  This can produce code which is difficult to follow and is therefore prohibited by the local style guide.
 ===== continue ===== ===== continue =====
  
guides/programstyle/goto.1596553732.txt.gz · Last modified: 2022/08/02 11:59 (external edit)