Brace all the if/for/while. #230

pull gmaxwell wants to merge 1 commits into bitcoin-core:master from gmaxwell:ifbrace changing 12 files +385 −162
  1. gmaxwell commented at 11:28 PM on March 27, 2015: contributor

    Unbraced statements spanning multiple lines has been shown in many projects to contribute to the introduction of bugs and a failure to catch them in review, especially for maintenance on infrequently modified code.

    Most, but not all, of the existing practice in the codebase were not cases that I would have expected to eventually result in bugs but applying it as a rule makes it easier for other people to safely contribute.

    I'm not aware of any such evidence for the case with the statement on a single line, but some people strongly prefer to never do that and the opposite rule of "always use a single line for single statement blocks" isn't a reasonable rule for formatting reasons. Might as well brace all these too, since that's more universally acceptable.

    [In any case, I seem to have introduced the vast majority of the single-line form (as they're my preference where they fit).]

    This also removes a broken test which is no longer needed.

  2. Brace all the if/for/while.
    Unbraced statements spanning multiple lines has been shown in many
     projects to contribute to the introduction of bugs and a failure
     to catch them in review, especially for maintenance on infrequently
     modified code.
    
    Most, but not all, of the existing practice in the codebase were not
     cases that I would have expected to eventually result in bugs but
     applying it as a rule makes it easier for other people to safely
     contribute.
    
    I'm not aware of any such evidence for the case with the statement
     on a single line, but some people strongly prefer to never do that
     and the opposite rule of "_always_ use a single line for single
     statement blocks" isn't a reasonable rule for formatting reasons.
     Might as well brace all these too, since that's more universally
     acceptable.
    
    [In any case, I seem to have introduced the vast majority of the
     single-line form (as they're my preference where they fit).]
    
    This also removes a broken test which is no longer needed.
    2632019713
  3. sipa merged this on Mar 27, 2015
  4. sipa closed this on Mar 27, 2015

  5. sipa referenced this in commit 41603aa727 on Mar 27, 2015
  6. sipa commented at 12:02 AM on March 28, 2015: contributor

    ACK

  7. dcousens commented at 2:00 AM on March 28, 2015: contributor

    @gmaxwell Why not just remove the test in a separate commit? Atomic commits! :)

    edit: never mind my previous comment

  8. dcousens cross-referenced this on Mar 28, 2015 from issue Avoid some implicit type conversions to make C++ compilers happy. by gmaxwell

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 11:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me