Using/Mixing C in C++ code?

前端 未结 12 1604
南旧
南旧 2020-12-24 03:03

Is using C in C++ bad?

Many people have told me that using C in C++ is bad because it\'s not as safe, and it requires more memory management. I keep telling them tha

12条回答
  •  北荒
    北荒 (楼主)
    2020-12-24 03:23

    If your'e talking about techniques, I'd be careful to say that doing the above is okay.

    Writing C++ programs using C-style program organization techniques will likely result in lots of maintainability issues. In general, the programmer is ignoring many of the benefits that an object-oriented language provides. Simply because much of C syntax is valid C++ and many coding techniques transfer does not mean you should do them in C++.

    That said, using C functions and things isn't a problem, so long as your'e careful about their use. In some cases, you have to.

提交回复
热议问题