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

Convert control statement bodies to blocks #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tfmorris
Copy link

Currently single line control statements are not enclosed in blocks. This is dangerous because people tend to follow the indentation, not the actual control structure, so the following:

if (a==true)
  statement 1

can be modified by someone who's not careful to be

if (a==true)
  statement 1
  statement 2

which won't do what they think it's doing. It's much safer to just always wrap things as blocks even though it costs an extra line of vertical space.

The automatic refactoring was done using Eclipse cleanup followed by manual verification.

- automatic refactoring using Eclipse cleanup
- nested statements without brackets are very error prone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant