MantisBT - Doomseeker
View Issue Details
0003810Doomseeker[All Projects] Cleanuppublic2020-06-07 04:202020-06-07 20:18
WubTheCaptain 
 
nonetweakhave not tried
confirmedopen 
1.3.1 
 
0003810: Some integer literals are cast to bool
Some code in Doomseeker uses integer values like 0 or 1 to indicate false / true, instead of those keywords. Not ideal (for readability).
Guesstimate some of them were an int type before (like in C89), then converted from int to bool without changing the value itself.

An example:
Quote from src/core/modreader.h
virtual bool load() = 0;

should be written as:
Quote from src/core/modreader.h
virtual bool load() = false;
$ grep -r "bool " src/ | grep "= 1" | wc -l
1
$ grep -r "bool " src/ | grep "= 0" | wc -l
16
$ grep -r "bool " src/ | grep "(1)" | wc -l
0
$ grep -r "bool " src/ | grep "(0)" | wc -l
0
$ grep -r "bool " src/ | grep "? 1" | wc -l
0
$ grep -r "bool " src/ | grep "? 0" | wc -l
0
'https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html [^]'
No tags attached.
Issue History
2020-06-07 04:20WubTheCaptainNew Issue
2020-06-07 04:21WubTheCaptainPrioritynormal => none
2020-06-07 04:25WubTheCaptainDescription Updatedbug_revision_view_page.php?rev_id=13127#r13127
2020-06-07 04:25WubTheCaptainSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13129#r13129
2020-06-07 20:15Pol MNote Added: 0021382
2020-06-07 20:18Pol MNote Added: 0021383
2020-06-07 20:18Pol MStatusnew => confirmed

Notes
(0021382)
Pol M   
2020-06-07 20:15   
For some reason, pure virtual/abstract classes are commonly expressed with:
= 0;

instead of:
=false;

That should stay like this since everyone does it like this (even though the other way may be more expressive)
(0021383)
Pol M   
2020-06-07 20:18   
If you find any other case apart from that, you can change it