Converting C source to C++

前端 未结 11 2014
迷失自我
迷失自我 2021-01-30 16:52

How would you go about converting a reasonably large (>300K), fairly mature C codebase to C++?

The kind of C I have in mind is split into files roughly corresponding to

11条回答
  •  情话喂你
    2021-01-30 17:10

    Let's throw another stupid idea:

    1. Compile everything in C++'s C subset and get that working.
    2. Start with a module, convert it in a huge class, then in an instance, and build a C interface (identical to the one you started from) out of that instance. Let the remaining C code work with that C interface.
    3. Refactor as needed, growing the OO subsystem out of C code one module at a time, and drop parts of the C interface when they become useless.

提交回复
热议问题