Commit b8fa42b
committed
fix(debug): Replace nullptr with false in DEBUG_ASSERTCRASH macros
Fix all instances of DEBUG_ASSERTCRASH(nullptr, ...) that cause compilation
errors in MinGW-w64 debug builds due to implicit nullptr-to-bool conversion.
Changes:
- PlayerTemplate.cpp: 1 instance fixed
- ChallengeGenerals.cpp: 1 instance fixed
- LoadScreen.cpp: 2 instances fixed
Total: 4 instances fixed across GeneralsMD codebase
The DEBUG_ASSERTCRASH macro expects a boolean condition as its first
argument. Using nullptr (std::nullptr_t) requires direct-initialization
to convert to bool, which MinGW treats as an error with -fpermissive.
These instances were introduced by commit f891c5f ("refactor: Modernize
NULL to nullptr") which converted NULL to nullptr throughout the codebase.
However, DEBUG_ASSERTCRASH(NULL, ...) was semantically DEBUG_ASSERTCRASH(0, ...)
meaning "unconditional crash", which is more explicitly written as
DEBUG_ASSERTCRASH(false, ...).
Error resolved:
error: converting to 'bool' from 'std::nullptr_t' requires
direct-initialization [-fpermissive]
VC6 compatibility: The 'false' keyword is fully supported in C++98 and
VC6, making this change safe for all target compilers.
Affects: GeneralsMD debug builds only1 parent f784923 commit b8fa42b
3 files changed
Lines changed: 4 additions & 4 deletions
File tree
- GeneralsMD/Code/GameEngine/Source
- Common/RTS
- GameClient/GUI
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1308 | 1308 | | |
1309 | 1309 | | |
1310 | 1310 | | |
1311 | | - | |
| 1311 | + | |
1312 | 1312 | | |
1313 | 1313 | | |
1314 | 1314 | | |
| |||
1579 | 1579 | | |
1580 | 1580 | | |
1581 | 1581 | | |
1582 | | - | |
| 1582 | + | |
1583 | 1583 | | |
1584 | 1584 | | |
1585 | 1585 | | |
| |||
0 commit comments