Detailed usage and maintenance of the C ++ Library

Source: Internet
Author: User

C ++ has many modern and exciting language features, such as templates and generic programming. At this point, C # and Java are also following up quickly. Learning C ++ also means learning any other advanced programming language, this chapter describes the problems of the C ++ library.

There are many trade-offs in language design, such as built-in finite precision integer and floating point types, such as pointers. This means that programming in this type of language is easy to fall into the so-called "abstract Vulnerability" of Joel. You need to think about and solve the problem at the abstract level provided by the language, at this time, the underlying knowledge can be of great help.

Therefore, it will be helpful to introduce the underlying knowledge from the Perspective of Programmers rather than electronic engineers-this is the recommendation of Computer Systems: A Programmers Perspective (CSAPP) A Chinese Translation of "deep understanding of computer systems.

  • Introduction to the C ++ Language Structure
  • Several minutes to help you solve the C ++ complexity Problem
  • C ++ programmers explain C ++ programming skills
  • Explore the wonders of the C ++ tutorial
  • How to better learn the C ++ Language

On the other hand, a key difference between C ++ and C is that C ++ adds an abstract mechanism on the basis of fully retaining the efficiency of C. The so-called "Modern C ++ style" advocates the correct use of the abstract mechanism of c ++ and the modern C ++ library constructed by these mechanisms, represented by STL, bjarne has long advocated C ++ as a new language different from C.

Taking memory management as an example, the use of modern C ++ memory management technology can almost completely avoid new and delete). Therefore, it is necessary to introduce the C ++ entry book from this idea. This is why the "Accelerated C ++" is recommended ). Andrew Koenig, author of Accelerated C ++, is one of the core figures in the C ++ standardization process.

C ++ has developed against the historical background of the popular C language. At the beginning and later, C ++ was a superset of C, all C features are available in C ++, which leads to a large number of subsequent C ++ introductory books starting with C.

In fact, this is misleading, because C ++ is a superset of C. However, the major significance of extending the C language with an abstraction mechanism is to overwrite all the language features exposed in C with abstraction, it allows programmers to program on a more natural abstraction layer.

For example, you do not use int * to add an array size n to represent an array, but use a Automatically increasing vector. For example, you do not use malloc/free, instead, we use smart pointers and RAII technology to manage resources;

For example, instead of adding a group of functions to an exposed class with a struct containing only data, you can use the real ADT. For example, you do not use the returned values of second-class to express errors, but use the first-class language-level exception mechanism. However, C is the source of C ++.

The abstraction coat of the C ++ library is removed, and the underlying layer is still C. What's more, in actual coding, sometimes "C" is required, for example, in the module-level binary interface encapsulation. Bjarne also said that abstract mechanisms such as OO/GP are only suitable for use in appropriate places.

When people have hammers, it is easy to treat all goals as nails. Sometimes C can provide simple and efficient solutions, for example, printf and fopen in the C standard library are inspired by the cloud style.) The user interface is a typical example.

In short, the spirit of understanding C language not only helps to better understand C ++, but also to use C ++ more rationally, it also has its practical significance-that is why The C Programming Language (TCPL) is recommended. We recommend that you read The C Programming Language before reading The Accelerated C ++ library.

Because, 1, The C Programming Language is very thin. 2. If you look at The problem with a comparative perspective, read The C Programming Language and then read Accelerated C ++. you will have a deeper understanding of the significance and practical functions of the introduction of Abstract Mechanisms to C ++.

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.