Skip to content
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

Replace postfix with prefix increment and decrement #3484

Conversation

N-Dekker
Copy link
Contributor

Followed common C++ guidelines, including:

Google C++ Style Guide: "Use the prefix form (++i) of the increment and
decrement operators unless you need postfix semantics."
https://google.github.io/styleguide/cppguide.html#Preincrement_and_Predecrement

Herb Sutter, Andrei Alexandrescu - C++ Coding Standards: 101 Rules,
Guidelines, and Best Practices: "Prefer the canonical form of ++ and --.
Prefer calling the prefix forms"
https://www.oreilly.com/library/view/c-coding-standards/0321113586/ch29.html

Follow-up to pull request #2493 commit f81578b "STYLE: Replace postfix by prefix increment in for loops in Core/Common"

@github-actions github-actions bot added area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Numerics Issues affecting the Numerics module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module area:Video Issues affecting the Video module type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct labels Jul 11, 2022
@N-Dekker N-Dekker force-pushed the Replace-postfix-with-prefix branch from 2021f7c to 917355e Compare July 12, 2022 11:14
Applied to the root of ITK source tree, at the GNU bash prompt:

    find . \( -iname itk*.cxx -or -iname itk*.hxx -or -iname itk*.h \) -exec perl -pi -w -e 's/  (\w+)\+\+;/  ++$1;/g;' {} \;
    find . \( -iname itk*.cxx -or -iname itk*.hxx -or -iname itk*.h \) -exec perl -pi -w -e 's/  (\w+)\-\-;/  --$1;/g;' {} \;

Excluded itkConceptChecking.h, as it is intended to check both the prefix *and*
the postfix forms. Excluded the unit tests, as they might intentionally test
the postfix forms.

Follow-up to:
pull request InsightSoftwareConsortium#2493
commit f81578b
"STYLE: Replace postfix by prefix increment in `for` loops in Core/Common"
@N-Dekker N-Dekker force-pushed the Replace-postfix-with-prefix branch from 917355e to 7cb6454 Compare July 13, 2022 15:51
@N-Dekker N-Dekker marked this pull request as ready for review July 13, 2022 15:52
@hjmjohnson hjmjohnson merged commit ec510c1 into InsightSoftwareConsortium:master Jul 14, 2022
N-Dekker added a commit to SuperElastix/elastix that referenced this pull request Jul 15, 2022
Applied to the root of elastix source tree, at the GNU bash prompt:

    find . \( -iname *.cxx -or -iname *.hxx -or -iname *.h \) -exec perl -pi -w -e 's/  (\w+)\+\+;/  ++$1;/g;' {} \;
    find . \( -iname *.cxx -or -iname *.hxx -or -iname *.h \) -exec perl -pi -w -e 's/  (\w+)\-\-;/  --$1;/g;' {} \;

Following ITK pull request InsightSoftwareConsortium/ITK#3484 commit InsightSoftwareConsortium/ITK@ec510c1

In accordance with common C++ guidelines, including:

Google C++ Style Guide: "Use the prefix form (++i) of the increment and decrement operators unless you need postfix semantics."
https://google.github.io/styleguide/cppguide.html#Preincrement_and_Predecrement

Herb Sutter, Andrei Alexandrescu - C++ Coding Standards: 101 Rules, Guidelines, and Best Practices: "Prefer the canonical form of ++ and --. Prefer calling the prefix forms"
https://www.oreilly.com/library/view/c-coding-standards/0321113586/ch29.html
N-Dekker added a commit to SuperElastix/elastix that referenced this pull request Jul 15, 2022
Applied to the root of elastix source tree, at the GNU bash prompt:

    find . \( -iname *.cxx -or -iname *.hxx -or -iname *.h \) -exec perl -pi -w -e 's/  (\w+)\+\+;/  ++$1;/g;' {} \;
    find . \( -iname *.cxx -or -iname *.hxx -or -iname *.h \) -exec perl -pi -w -e 's/  (\w+)\-\-;/  --$1;/g;' {} \;

Following ITK pull request InsightSoftwareConsortium/ITK#3484 commit InsightSoftwareConsortium/ITK@ec510c1

In accordance with common C++ guidelines, including:

Google C++ Style Guide: "Use the prefix form (++i) of the increment and decrement operators unless you need postfix semantics."
https://google.github.io/styleguide/cppguide.html#Preincrement_and_Predecrement

Herb Sutter, Andrei Alexandrescu - C++ Coding Standards: 101 Rules, Guidelines, and Best Practices: "Prefer the canonical form of ++ and --. Prefer calling the prefix forms"
https://www.oreilly.com/library/view/c-coding-standards/0321113586/ch29.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Numerics Issues affecting the Numerics module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module area:Video Issues affecting the Video module type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants