Zandronum Chat @
Get the latest version: 3.0
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003815Doomseeker[All Projects] Cleanuppublic2020-06-07 06:002020-06-08 13:42
Assigned To 
PrioritynoneSeveritytrivialReproducibilityhave not tried
PlatformOSOS Version
Product Version1.3.1 
Target VersionFixed in Version 
Summary0003815: Found else statements after interrupted control flow
DescriptionThis is just a code style thing, so sort of trivial or a matter of undetermined preference.
Quote from clang-tidy
Please do not use else or else if after something that interrupts control flow - like return, break, continue, throw.

Refers to LLVM Coding Standards.
I personally agree with the clang-tidy suggestion here.
Steps To ReproduceSome hand-picked examples (not exhaustive):
src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp-            return gameParametersList();

src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp-    }
src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp:    else
src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp-            return NoneCanVote;

src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp-    }
src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp:    else if (rbSpectatorsCantVote->isChecked())

src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp-            return SpectatorsCantVote;

src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp-    }
src/plugins/zandronum/createserverdialogpages/votingsetupwidget.cpp:    else
src/plugins/zandronum/zandronumbinaries.cpp-            return ExeFile::pathToExe(message);
src/plugins/zandronum/zandronumbinaries.cpp-    }
src/plugins/zandronum/zandronumbinaries.cpp:    else

grep -B 2 -r "else" src/ | less can be somewhat helpful.
Additional Information [^]

NB: That page's advice also contradict's clang-tidy's readability-braces-around-statements check (which is also a check I don't agree with). 🙂
Attached Files

- Relationships

-  Notes
User avatar (0021389)
Pol M (developer)
2020-06-07 20:45

I personally see no special need to do this change, one could argue that it provides intent to add the else's, so I would not bother with this one (plus it will probably change the entirety of the files XD)
User avatar (0021406)
Blzut3 (administrator)
2020-06-08 01:21

I'm indifferent about this one. I personally do both styles based on what appears to be more readable for the particular block of code. Generally go with the recommendation here, but sometimes that needless else just looks right.
User avatar (0021435)
Zalewa (developer)
2020-06-08 13:42


Issue Community Support
Only registered users can voice their support. Click here to register, or here to log in.
Supporters: No one explicitly supports this issue yet.
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2020-06-07 06:00 WubTheCaptain New Issue
2020-06-07 20:45 Pol M Note Added: 0021389
2020-06-07 20:45 Pol M Status new => feedback
2020-06-08 01:21 Blzut3 Note Added: 0021406
2020-06-08 02:17 WubTheCaptain Status feedback => acknowledged
2020-06-08 13:42 Zalewa Note Added: 0021435

Questions or other issues? Contact Us.


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker