Converting C source to C++

前端 未结 11 1999
迷失自我
迷失自我 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:30

    I would write C++ classes over the C interface. Not touching the C code will decrease the chance of messing up and quicken the process significantly.

    Once you have your C++ interface up; then it is a trivial task of copy+pasting the code into your classes. As you mentioned - during this step it is vital to do unit testing.

提交回复
热议问题