How to better learn the C ++ language?

Source: Internet
Author: User

The C ++ language is one of the most popular programming languages in the programming world. There are several methods to learn the C ++ language that are common errors, many people are wasting a lot of time learning the C ++ language, which is also a headache.

Why are there so many mistakes? There are three main reasons: first, there are too many details about the C ++ language. Second, some famous C ++ books always imply the importance and fun of language details (whether intentionally or unintentionally. Third, the development philosophy of modern C ++ libraries must use some technical details (but note that it is library design rather than routine programming ). These jointly shape the overall mentality and philosophy of the C ++ community.

The first article alone may not be able to generate a climate, and there are also a lot of details in other languages (although it is a little cool than C ++). For javascript, scope rules, name searches, closure, for/in, these are all details, and they also violate intuition. But the concept of programmers in many dynamic languages I guess is about where to use it. But C ++ is different. People who learn C ++ have a potential mentality similar to being hinted, that is, you must thoroughly understand the language core before you can write beautiful programs. This is the first error.

The second reason for this consciousness is C ++ books. There are countless C ++ books on the market, but one common drawback is that there are too many books about language details-C ++ gotchas, Objective C ++, more Effective C ++, but it is understandable that C ++ is such a language: to satisfy the needs of modern programming concepts.

Especially for C ++ library development, you must pay attention to the language details, and even use the language details in C ++ has become a learning topic. For example, when I learned the C ++ language template, I did not think of the template meta-programming at the beginning of the design. I did not expect the C ++ template system to be completely Turing, this has led to the shock of Modern C ++ Design and C ++ Template Metaprogramming.

Why are these technologies so shocking? For example, It's like a piece of land where everyone thinks they are already very familiar and have no secrets at all, one day someone dug the ground and found the most abundant oil. Although C ++ has some details before, it is still easy to grasp, but it is a happy old times for C ++ programmers, because everything in C ++ is at a glance, everything is figured out.

However, the birth of Modern C ++ Design tells people that "You have not mastered the details ." As a result, programmers who have learned the C ++ language for a long time have been re-ignited to step into the details of the swamp. In particular, template programming further explores the details of C ++ to the extreme-why do we care about the priority of implicit conversions involving class objects? Look at boost: is_base_of to see how strange it is.

But the biggest problem is that there is a reason to pay attention to these details: to develop a modern Template library and to develop an active library, we must use the template programming technology, to use the template programming technology, you must use the language's leading role character, enable_if, type_traits, and even C macro, which has never been a wave before, to see boost :: the preprocessor knows how strange it is, and even the Turing completeness of the C macro (during the pre-compilation period) is mined.

Why? Fun? Advertised? None. the actual requirements of the Development Library. But this is also the biggest sorrow. In boost, the best teaching material that uses the language details for magical task completion is boost: foreach. This small facility's exploration of the language details has reached the level of surprise.

  • Interpret and analyze the C ++ linked list
  • Introduction to the working principle of the C ++ iterator
  • How to Use the C ++ Test tool in C ++
  • Summary of differences between C ++, C #, and Java
  • Analyze the three important elements of C ++ Variables

If you don't believe it, try to check its source code first, and then read the article about it by the author. And boost: typeof is also unwilling to follow-there are too many technologies in the C ++ language that are "discovered" rather than "invented. Didn't everyone who had no intention of setting these language rules begin with Les?

Because there is no variadic templates, we use macro to add the default template parameters to achieve similar results. Because there is no concepts, people use templates to add the details of destructor to accomplish similar work. Because there is no typeof, people use template metaprogramming and macros to add endless details to achieve the goal... The DIY spirit of C ++ language developers is not weak.

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.