Analysis on the C ++ Language Style

Source: Internet
Author: User

For users and scholars who first came into contact with the C ++ language, it is very important to understand the concept of the C ++ language. let's first talk about what the C ++ language is, the so-called C ++ language is a widely used computer programming 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 basically has 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 the object-oriented mechanism for C language is to find a "suitable tool ".

To achieve 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.

If C ++'s native parents are C language and Simula language, then in 1984, the I/O stream technology implemented by using Operator Overloading is the First Step C ++ has taken to the new Code style. The above code is from the sample program in C ++ programming language written by Stroustrup. Note that the line of code connected by "<", I/O streams, variables, and character constants are cleverly connected together in the code.

From a technical point of view, the introduction of this new syntax makes up for the weakness of the printf () function family in C language in the lack of type security mechanisms and scalability. In terms of code style, "<" and other easy-to-understand operators greatly change the programmer's first impression on the C ++ language.

When I first came into contact with the C ++ I/O Stream library, I clearly felt that, a c ++ genie trying to get rid of the constraints of the C language style is "Flowing" along with streams composed of "<" and ">"-this kind of code style has been around for more than a decade. it has shown the determination and courage of the C ++ language in creating a new image and introducing new ideas.

From the end of 1980s to the beginning of 1990s, the emergence of Window environments such as X Window, Mac OS, and Windows has successively raised new issues for program design, C ++ makes object-oriented and traditional development methods the best choice for programming languages in windows. A batch of window frameworks based on C ++ language have not only achieved commercial success, but also greatly changed the style and features of C ++ language.

The C ++ framework, which was first favored by most programmers in window development, was the OWLObject Windows Library built in Borland C ++ 1992 in 3.1. The following sample code is taken from Borland C ++:

To solve the most critical message ing problem in Window Programming, the OWL designer introduced "= […]" to the member functions in the C ++ language. This is a language style that many programmers who have used Borland C ++ can never forget.

I admit that Borland provided us with the best compiler and the best integrated development environment IDE in the early stages of C ++ development ), however, the alternative language style introduced by Borland for C ++ through the OWL framework does not seem to be flattering and objective, and this account should not be included in Borland, because the predecessor of OWL was Borland's framework code purchased from White Water ).

  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

Related Article

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.