s********1 发帖数: 581 | 1 C 和 C++ 相比有什么优点?
一般认为C++ 是 C 的 superset. C 有的功能 C++ 都有,而 C++ 多了Object-
oriented programming 和很多 library functions. 据说C 和 C++ 的速度也差不多。
那么C 还有什么优势吗? | s**i 发帖数: 381 | 2 portability
faster building time
【在 s********1 的大作中提到】 : C 和 C++ 相比有什么优点? : 一般认为C++ 是 C 的 superset. C 有的功能 C++ 都有,而 C++ 多了Object- : oriented programming 和很多 library functions. 据说C 和 C++ 的速度也差不多。 : 那么C 还有什么优势吗?
| s********1 发帖数: 581 | 3 how about runtime? is C still faster than C++??
【在 s**i 的大作中提到】 : portability : faster building time
| M**8 发帖数: 25 | 4 For same quality C++ and C codes, I would say C is faster. Just like
Assembly will be faster than C. The features that are unique to C++ I can
think of are:
object oriented, Encapsulation, inheritance, polymorphism, exception
handling, class, templates, Function overloading, virtual func, new/delete
instead of malloc/free, namespace, type casting, overloading of operators,
inline func, pure virtual func, scope rule
In short, more powerful. | h***z 发帖数: 233 | 5 You can write C++ code that runs just as fast as C.
【在 s********1 的大作中提到】 : how about runtime? is C still faster than C++??
| w***n 发帖数: 1137 | 6 for a specific code, it might be, but for a big complicate code, c may be
faster.
But for the current hardware, the difference is not too big.
【在 h***z 的大作中提到】 : You can write C++ code that runs just as fast as C.
|
|