What C language and C ++ have to say

Source: Internet
Author: User

Speaking of C language, you have to say its successor-C ++ language. As we all know, the C ++ language is developed based on the C language by adding the features of modern programming languages such as object-oriented and templates. The two are similar in terms of syntax rules, number of operators, and usage. Therefore, we often refer to these two languages as "C/C ++ ". Although the two are very similar because of their natural kinship, just like the father and son look similar, the father and son are two different independent individuals after all, C and C ++ are two independent programming languages with their own characteristics. In terms of operating hardware resources, the C language is more direct, while the C ++ language is relatively mild.

In addition to the differences in these syntax rules, the essential difference between the two lies in the difference in the adopted programming methods. C language is a structured programming language. As Tan said, it focuses on algorithms and data structures. The primary consideration of C program design is how to use a process (usually in the form of a function) for input (or environmental conditions) operations are performed to obtain the output (or control the process or transaction). For C ++, the primary consideration is how to construct an object model, this model can adapt to the actual problems, so that the process or transaction can be controlled by obtaining the object state information.

Therefore, the biggest difference between C and C ++ is that they are used in different ways to solve problems. The reason why C ++ is more advanced than C is that the concept of "design" has been incorporated into C ++, and for a single language, in C, more are the concepts of algorithms. C language is an autonomous subset of C ++. C language implements procedural control and other related functions in the C ++ language, while C in the C ++ language (we can call it "C + "), compared with the original C, C ++ introduces new things such as overload, inline functions, and Exception Handling. It expands the content of object-oriented design, such as classes, inheritance, virtual functions, templates, and container classes to better meet the needs of modern programming.

From the comparison of these C and C ++ languages, the C ++ language, as a successor to the C language, seems to have completely surpassed the C language. Then we naturally have a question: Since the C ++ language is better than the C language, why should we not directly learn the better C ++ language but learn its past-C language?

Without a doubt, C ++ is an excellent programming language. It absorbs many advantages of C language and adds many new features of modern programming language, this is why it has long been a mainstream programming language. However, there is no such thing in the world, and no language is omnipotent. c ++ is not suitable for all application scenarios. In some respects, C language has a greater advantage than C ++. Many tasks that cannot be completed by C ++ can be easily completed by C language. For example, in the NVIDIA Cuda computing system, due to the limitations of the operating system abi and the execution units in its special architecture, C ++ initialization tasks cannot be supported, and only the C language is implemented, c ++, which is too complex, is not implemented in the end. Many embedded development systems only provide the C language development environment, but do not provide the C ++ development environment. Many C ++ languages do not want to do dirty work, C language is doing well. For example, for some large systems with extremely high performance requirements, such as search engine algorithms and banking and financial systems, only the diligent C language can accomplish these tasks well, and C ++ is too complex, this is a little inferior.

It is precisely because the C language combines features close to the underlying layer and higher performance, and the language is more concise than the C ++ language, since it was created in the 1970s s, it has always been a mainstream programming language and is favored by many programmers. With the development of embedded development and large-scale algorithm applications in today's world, especially the rise of search engines and cloud computing, the use of C language has not shrunk, but has gradually expanded. Therefore, if you are interested in the development of these fields, C language is your best choice.

In combination, the learning of C and C ++ languages can promote each other. Learning C language well can lay a good foundation for us to further learn C ++ language in the future. The learning of C ++ language will also promote our understanding of C language, so as to better use C language.

Http://blog.csdn.net/turingbooks/article/details/7860153

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.