From "thinking in C + +" was forced to transfer to "C + + Primer" the first day

Source: Internet
Author: User
Tags uppercase letter



Today gnawing "thinking in C + +" kind of can not continue to feel, on the one hand I can't stop reading a book, difficult to understand + no rest easy to sleepy, so look at the speed is not fast. In addition, there is a lot of content in the theory based on your understanding of its use, so I know I need to make up the basics. Check online, make sure to see "C + + Primer" in the string.


The first to second chapter of C + + Primer notes

Some basic types, control statements, keywords or something I skipped.

1. When # include, the header file of the standard library is enclosed in angle brackets < >, and the header file of the nonstandard library is enclosed in double quotation marks.
2. Output buffers typically must be explicitly flushed to force output buffer content. By default, read CIN refreshes cout, and cout is refreshed when the program ends normally.
3. Using a double type is basically not an error. The implicit precision loss in float type can not be neglected, while the cost of double type precision is negligible relative to the float type precision cost. In fact, on some machines, the double type is much faster than the float type calculation. The precision provided by a long double type is often unnecessary and requires additional operating costs.
4. Alarm (Bell) character \a (just feel Interesting)
5. There are some places where spaces cannot be inserted, one of which is in the middle of the word. In particular, you cannot break a line in the middle of a word. But you can do this by using a backslash symbol:
Std::cou\
T << "Hi" <<endl;
Equivalent to Std::cout << "Hi" <<endl;
The identifiers in the 6.c++ are case-sensitive
7. In addition to keywords, the C + + standard retains a set of identifiers for use in standard libraries. Identifiers cannot contain two consecutive underscores, nor can they begin with an uppercase letter immediately after the underscore. Some identifiers (identifiers defined outside the function) cannot begin with an underscore.
8. Initialization is not a value assignment
9. Replication initialization and direct initialization are different
int ival (1024); Direct-initialization
int ival = 1024; Copy-initialization
10. You can initialize a string object with one counter and one character. To make a specified character that contains multiple repetitions: std::string all_nines (10, ' 9 '); All_nines= "9999999999"

11. Variables defined in the function body are initialized to 0, and the built-in type variables defined in the function body are not automatically initialized.


See 2.3, too late, the head is not fit, tomorrow continue to see it.

Feeling 1: Are foreign authors very old? This book and "thinking in C + +" like, a lot of repeated instructions, over and over, no way to adapt to it, who called this is a famous book.

Feel 2: feel some authors including foreign authors, especially willing to put some bad habits of research in the book Occupy space, for example, C + + support a local variable and global variable name is the same, and the United States its name "C + + scope can be nested." I think this kind of bad habit should be forbidden, at least not recommended, not to beautify. Make it clear that if you differentiate between the two.

From "thinking in C + +" was forced to transfer to "C + + Primer" the first day

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.