The father of Linux is not rough

Source: Internet
Author: User

The father of Linux shot C ++: the spam language of bad programmers

The father of Linux is not rough I have to read two comments from C ++ to C ++. Whether the C language should be thrown into the recycle bin
Why should every programmer learn C language? Should every programmer learn C language? I don't think so C language is dead, five reasons to forget it
C ++ 0x: The brand new C ++ or another Java?
Three theorem of Programming Language Why Dynamic Language embarrassment Dynamic Language View

Cited by Meng Yan's blog: Linus Torvalds tried to use C ++ to develop the Linux kernel more than a decade ago. For various reasons, it soon failed. Since then, he has expressed dissatisfaction with C ++ from time to time. Liu jiang translated the article "C ++: Bad programmer's spam language by the father of Linux" only recently. Despite the fierce rhetoric, the words are not rough.

Today, in general, C and C ++ are mainly used for system-level software development. Specifically, the C/C ++ write platform, tool, and basic library support high-level languages to complete application logic. In the article "Microsoft architects talk about programming language development", Brian Beckman bluntly said that the C ++ language is mainly used to develop other languages. This is one-sided. If it is changed to "C ++ language, which is mainly used to support other languages", then it is generally correct.

When developing system software, it is important to understand how the system operates. The beautiful abstract techniques and advanced features are secondary.

There is an interesting phenomenon. Many experienced system software engineers have returned to C after using C ++ for a while. At this level, the advantages of C ++ for C are not prominent. Those advanced abstract structures are often unnecessary. Rather, the improvement of the abstract level makes it difficult for developers to figure out what actually happens below. Therefore, many veterans actually think that the C language is more controllable and more handy. A real C language expert is familiar with both the language and compiler. Basically, when writing C, I already know what the compilation code will look like after Compiler optimization, you can even change the C code to guide the compiler to produce the optimal machine code. C ++ has many mechanisms, many of which are prepared to meet the needs of high-level applications and frameworks. At this level, the clarity is sacrificed. Most of the time, what will happen behind a simple statement, even a veteran cannot tell. For example:

std::string s(“Linux Torvalds");
std::string scopy = s;

The above Code creates two copies of strings with the same content, but no one can clearly describe what is happening in the background without learning more information, different STL has different implementation methods for string, so the performance of copy assignment is also different. Some may be simply copying string objects, and some may have the ref-counting mechanism, you need to create an object, set the object value, and increase the number of referenced items. Some do not consider thread security. Some consider thread security and lock and unlock. There are also many ways to add and unlock. When creating a new string object, you sometimes need to call the memory distributor, and the implementation of this item is varied. Some directly use new char [], and some apply from the built-in memory pool, is memeory pool thread-safe? Sorry, this may involve the issue of adding and unlocking again. Will the memeory pool be full? Do you want to call new/malloc in sequence to apply for a new memory block? In short, there are too many complex things to follow, and there is not enough skill to understand the platform deeply. It is difficult to say a word about it.

The same is true for a string, not to mention other advanced features. Therefore, it is understandable that many people would rather bother than use C ++.

Personally, I am willing to use C ++, especially when I write realloc again and again in C, I think of string: operator + = () benefits. STL gave me a deep impression. When I write an algorithm program, I feel uncomfortable without using STL. A transform can solve the problem and I have to use a for loop, this makes me feel uncomfortable. In general, I still use C ++ to solve a problem. For me, Torvalds is actually very pertinent. Even with C ++, we should try our best to figure out what happened behind it, in this way, you can be sure when writing a low-level program. If you are designing an application-level program, try not to use C/C ++, and forget the underlying things. It is the right way to concentrate on designing the application layer.

Related Articles]

  • The father of Linux shot C ++: the spam language of bad programmers
  • I have to read two comments from C ++ to C ++.
  • Who will be the mainstream of Dynamic Language in the next few years?

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.