Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require braces #623
Require braces #623
Changes from 10 commits
b4d791f
29d5925
65ba921
3f82966
5b619f9
039134b
859b2d4
c0abce2
d803134
aa9d763
070cfd2
ff159d1
9a105cf
0586a39
563bed2
1a57818
de64518
3aafa77
e4dd6a4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems worth including as background the CERT rule:
https://wiki.sei.cmu.edu/confluence/display/c/EXP19-C.+Use+braces+for+the+body+of+an+if%2C+for%2C+or+while+statement
And the blog post about
goto fail;
: https://www.imperialviolet.org/2014/02/22/applebug.htmlFWIW, I'm not suggesting that
goto fail;
should be a strong rationale for this pattern, but I do think it should be addressed explicitly as it is often cited as a reason for this change. FWIW, I agree with @zygoloid below that simplifying the language grammar seems like a strong motivation. I actually like the summary of the importance of braces here in the blog post:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linked.
Added, moved up the link that was in rationale.
Are you saying to remove the mention of
goto fail
from the rationale? Do you want this sentence somewhere in particular?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, I'm happy mentioning it, I just didn't want to overstate its importance. I've suggested a place where it could even be included in the disadvantages section, but that's optional given the comment in the rationale. Up to you.