How to rewrite a C++ codebase successfully

submited by
Style Pass
2024-05-06 10:30:05

I recently wrote about inheriting a legacy C++ codebase. At some point, although I cannot pinpoint exactly when, a few things became clear to me:

So it was apparent to me that sticking with C++ was a dead end. It’s simply a conflict of values and priorities: C++ values many things that are not that important in this project, such as performance above all; and it does not give any guarantees about things that are crucial to us, such as memory and temporal safety (special mention to integer under/overflows. Have fun reviewing every single instance of arithmetic operations to check if it can under/overflow).

The only solution would be to train everyone in the team on C++ and dedicate a significant amount of time rewriting the most problematic parts of the codebase to perhaps reach a good enough state, and even then, we’d have little confidence our code is robust against nation-state attacks.

It’s a judgment call in the end, but that seemed to be more effort than ‘simply’ introducing a new language and doing a rewrite.

Leave a Comment