Old Compiler, New Compiler
It’s really amazing how much better C/C++ compilers are at static analysis during compilation. I found a note from Feyr mentioning that as of July 22, 1998, the code would compile without error using the compiler flags “-Wall -Werror”.
Sadly, that’s no longer the case. Compiling with “-Weverything” now results in 7,773 warnings, all of which I intend to fix. Most are pretty trivial, but some of the game’s never-fixed bugs might just be related to these correctness issues. And this is 7,773 warnings remaining after I fixed several hundred errors flagged by the compiler which would have caused serious issues in the game.
It will be a slow-going slog to get through all of these and fix the underlying issues, but it needs to be done.
The game is written in a “C with a few classes” style and looks like it was part way through a conversion from C to the “C with classes” style of C++ that was common in 1997-1998. I am not remotely a good modern C++ programmer since I spent the vast majority of my development time in other languages, but it’s the style I’m used to and I also intend to modernize the implementation a little bit at a time.
I’ve now managed to fix most of the Valgrind errors flagged when the game boots, so memory leaks will hopefully be small. I’ve now turned my attention to fixing the errors flagged by clang’s static analyzer.
As you can see by the image, I’m making some progress. Unfortunately, I’ll be extremely busy at work the next few days, so progress will be slower.
–Untermina