History of C to C ++

Source: Internet
Author: User

The smooth promotion of the C ++ language is obviously very grateful to the large user base of the C language, but the C language style is also deeply branded with the C language, that's why many people prefer the C ++ language.

The program code also has a style, which is nothing new. As early as 1980s, C language programmers had to choose between K & R and ANSI. But in all fairness. I have never seen a language like C ++ that is so subtle and elusive in terms of code style: no one can tell how many different styles C ++ code can derive.

However, I know that many C ++ beginners are familiar with C ++ codes of different styles, I often mistakenly think that I have seen several completely different programming languages-this alone is enough to remind us, it is imperative to study and clarify the evolution and development rules of C ++ language styles.

Similar to the style changes of previous dynasties, the study of C ++ language style has no shortcut. We can only follow the historical context and find the source of the Code style based on the research method of "ending with a table" [1] advocated by Liu Yu in Wenxin Diao Long, explores the internal cause of style evolution and clarifies the trend and laws of technological development.

1. C with classes-an attack on the C language style

Before Bjarne Stroustrup adopted Rick Mascitti's suggestion in December 1983 and named the new language it invented as "C ++", people used "CC with Classes) it is called a "dialect" that originated from the C language and has a data abstraction mechanism ". Although C with classes is essentially only a scalable language that can be converted into a traditional C language code by the pre-processing program Cpre, which is similar to the pre-processing process of Pro * C language we saw in Oracle, but it did lay the foundation for all later C ++ Code in terms of style.

 
 
  1. class stack {  
  2.   char s[SIZE];  
  3.   char* min;  
  4.   char* top;  
  5.   char* max;  
  6.   void new();  
  7. public:  
  8.   void push(char);  
  9.   char pop();  
  10. }; 

The Code "C with classes" is recorded in Stroustrup's "design and evolution of C ++ language". The new () in the Code is actually a stack-like constructor, which is very different from the later C ++ language. Obviously, Class C almost completely inherits the C language style. The statement in the code looks exactly the same as the C language, and the class structure is roughly the same as that in the C language.

These signs indicate that the C ++ language comes from C and is compatible with C as much as possible. This design idea not only facilitates the rapid popularization of C ++, but also facilitates the smooth development of C ++. promotion obviously benefited from the large user base of C language ).

In addition, the C language style has been deeply branded with the C language, so that after a few years, when the C ++ language has basically had an "independent personality, stroustrup also has to remind people to leave the C language thinking style as far as possible.

On the other hand, Stroustrup firmly rooted in Class C from the class, derivation, access control, and other object-oriented concepts borrowed by the Simula language. According to Stroustrup, the intention of introducing an object-oriented mechanism for C language is to find a "suitable tool" [2] to implement a distributed system or solve similar complex problems. However, stroustrup binds the efficiency of C with the elegance of Simula. In fact, it has laid the seeds of "Double Character" for the C ++ language-it is hard to say that this is not the C ++ language style. diverse direct incentives.

  1. Introduction to C ++
  2. Summary Notes on learning and exploring C ++ library functions
  3. Basic Conception and method of C ++ Class Library Design
  4. Does C ++ really have market value?
  5. Basic Conception and method of C ++ Class Library Design

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.