Currently I am working on a C++ project. It's for business use, so this project is not open sourced. However, this is a project with a fairly large code base (around 10k lines of code) and a couple of external linked libraries and binaries. The problem is nearly 80% of the code base is written in C style rather than C++ style, but the main interface is written in C++11 standard and needs to be compiled in C++11. One of the most inconvenient parts of the C style code is plenty of
goto statement are used, and I can tell the purpose of using
goto is to ensure the code is thread safe and clean up the garbage right in time. (They worked) When I first learned C++, I started with C++11, and I think RAII is the modern fashion to replace the hacky style to ensure the code is thread safe and resources being used are cleaned up in time.
I am assigned to add a series of new functions in the project. Some of my changes have to make in these C style code base. And if I changed one of them, why not refactor all of them in C++1x style? The conflict is given limited time, I can't finish refactoring all of them, not even 80%. And these C style code bases are also using some C style based libraries, I don't know if I changed my code from C style to C++ style, will these external libraries work as before? Will there be equivalent C++ libraries to replace those deprecated C libraries? So my puzzles are: Given limited time, how to refactor large code base legacy C++ project from C style to C++ style effectively? What is the trade off? Is the trade off worth considering?