The horror of C + + language

Source: Internet
Author: User

Turn from: http://coolshell.cn/articles/1724.html

Linus once (September 2007) in the newsgroup gmane.comp.version-control.git and a Microsoft Engineer (Dmitry Kakurin) in a dispute between C or C + +, The Microsoft engineer at the time was primarily working on Git's Windows version, but he found that Git's source code was written in C rather than C + +, so he posted a kakurin in the Linux community expressing dissatisfaction with Linux, which was straightforward:

Pure C as opposed to C + +. No idea why. Please don ' t talk about portability, it ' s BS. (Pure C Write, not C + +, do not know why, please don't tell me is for transplant sex, this is completely nonsense.) )

Linux father Linus Torvalds immediately posted, in the post, Linus words very direct, direct that C + + is a very scary language, he said in the post:

*you* are full of bullshit. C + + is a horrible language. It's made more horrible by the fact, a lot of substandard use it. (You're the absolute nonsense.) C + + is a very scary language, and more frightening than it is a lot of unqualified programmers are using it.

Linus this point of view I am more agree with, I personally also in a few years ago, "STL string writing Copy" and later in some articles expressed in C + + is indeed not a very mature language, this view has been around me. This is because its learning costs are too high, the compiler and class behind you do a lot of things you do not know, and, C + + is very easy to make mistakes and many unexpected problems occur.

Of course, this article is not to continue to denounce C + +, nor to review an earlier event. We only talk about technology here. Yesterday, I saw an evil example of C + + on the Internet, here to give you a share, let you see C + + programming language of the horror and evil side. The following example is more sinister than the "#define private public".

Please look at the code below, can you tell me what it will output. (Note the highlighted line in the main function)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30-31 #include <iostream> #include <vector> typedef int UINT4; using namespace Std;   Class Hack {}; hack& operator< (Hack &a, Hack &b) {std::cerr << "less than operator \ n";

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.