〈effective c++〉 Reading notes--introduction

Source: Internet
Author: User

Introduction

1, learning the fundamentals of a programming language is one thing; Learning how to design and implement effective programs in, language is something else entirely.

Remembering < refactoring > saying, it's easy to write code that the computer can understand, but it's not easy for a good person to understand the code.

2, A declaration tells compilers about the name and type of something, but it omits certain details.

3, initialization is the process of giving a object its first value.

4, constructors declared explicit is usually preferable to non-explicit ones, because they prevent compilers from Performi ng unexpected (often unintended) type conversions. Unless I has a good reason for allowing a constructor to being used for implicit type conversions, I declare it explicit.

Explicit keyword restrictions cannot be implicitly converted

5. The copy constructor is used to initialize an object with a different object of the same type, and the copy assignment O Perator is used to copy the value from one object to another of the same type

1 classWidget {2  Public:3Widgets ();//default constructor4Widgets (Constwidget& RHS);//copy Constructor5widget&operator=(Constwidget& RHS);//Copy assignment operator6 ...7 };8Widget W1;//invoke default constructor9Widget W2 (W1);//Invoke copy constructorTenW1 = W2;//Invoke copy Assignment operator</span> OneWidget W3 = W2;//Invoke copy constructor!</span>

Pass by value is using copy constructor

6, undefined behavior: compiler indeterminate behavior, such as an array of cross-border access, dereference a null pointer, etc.

7. When I use the term "interface," I ' m generally talking about a function ' s signature, about the accessible elements of a Class (e.g, a class ' s "Public Interface," "" Protected Interface, "or" Private Interface "), or about the expressions that M UST is valid for a template ' s type parameter (see Item 41).

8, A client is someone or something this uses the code (typically the interfaces) you write.

9, favorite parameter names, for example, is LHS and RHS. They stand for "left-hand side" and "right-hand side," respectively.

10. I often name pointers following the rule that a pointer to an object of type T is called Pt. I use a similar convention for REFERENCES:RW might is a reference to a Widget and RA a reference to an airplane. I occasionally use the name MF when I am talking about member functions.

11. As a language, C + + has no notion of threads-no notion of concurrency of any kind, in fact.

12, TR1 ("Technical report 1") are a specification for the new functionality being added to C + + ' s standard library. This functionality takes the form of new class and function templates for things like hash tables, reference-counting Smar t pointers, regular expressions, and more. All TR1 components is in the namespace tr1 that ' s nested inside the namespace Std.

13, Boost is an organization and a Web site (http://boost.org) offering portable, peer-reviewed, open source C + + libraries. Most TR1 functionality are based on work do at Boost, and until compiler vendors include TR1 in their C + + library Distri Butions, the Boost Web site is likely to remain the first stop for developers looking for TR1 implementations. Boost offers more than are available in TR1, however, so it's worth knowing about in any case.



〈effective c++〉 Reading notes--introduction

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.