User Tools

Site Tools


guides:programstyle:codeblocks

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:codeblocks [2020/07/24 14:45] – [Discussion] wikiadminguides:programstyle:codeblocks [2024/07/25 15:01] (current) – external edit 127.0.0.1
Line 70: Line 70:
 </code> </code>
  
-Unfortunately, his has further broken the code.  The programmer probably assumes that both lines following the for loop will be executed as the body of the loop, but this is not the case.  Only the output line will be executed.  Had the programmer followed the convention of always placing the body of a control structure in a code block, this would not be the case.+Unfortunately, this has further broken the code.  The programmer probably assumes that both lines following the for loop will be executed as the body of the loop, but this is not the case.  Only the output line will be executed.  Had the programmer followed the convention of always placing the body of a control structure in a code block, this would not be the case.
  
 Failure to follow this convention leads to bugs so frequently that as of g++6, there is a flag to warn when this situation occurs (-Wmisleading-indentation).   Failure to follow this convention leads to bugs so frequently that as of g++6, there is a flag to warn when this situation occurs (-Wmisleading-indentation).  
guides/programstyle/codeblocks.1595601904.txt.gz · Last modified: 2024/07/25 15:01 (external edit)