In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Today, I will talk to you about why the C language will not be out of date. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
To evaluate any programming language is to be scolded. It's always like this. It's like the chilly season in spring, when people wearing cotton-padded jackets and single clothes pass by in the street, and both sides must have two words in their hearts at the same time: "stupid!" This has a professional name in psychology: it is called the "two-pushy" phenomenon!
Then why do I have to do this scolded thing? But I still want to systematically introduce the language, its characteristics, and its future. This problem is very important to many newcomers who have just entered the field of programmers. Because they are deeply worried, what if C is as obsolete as Fortran,perl?
First of all, on the table, this is the famous TIOBE language ranking. At present, it is the most authoritative ranking of language popularity, from which you will get the most intuitive conclusion. Both Java and C are falling, and the decline is divided by languages after the third place.
For all programming languages, their ultimate goal is to improve the running efficiency of hardware and the development efficiency of programmers.
Unfortunately, these two points cannot coexist! You can only choose one. In terms of improving the running efficiency of the hardware, the C language has no competitors! To take a simple example, implement a list. The C language uses an array inta [3] and becomes (base address + offset) after compilation. For a computer, no operation is faster than addition, and no method is faster than (base address + offset) access.
The C language has compressed the running efficiency of the hardware to the extreme.
The problem brought by this design idea is the lack of ease of use and security. For example, you can't mix and save different types in an array, or the compiler won't be able to calculate the correct offset. At the same time, the C language is also indifferent to the error offset, which is the infamous out-of-boundary problem in the C language.
The self-proclaimed "trust programmer" in the C language is beautiful, and its only purpose is to be fast, either to run or collapse at full speed. C language only cares about whether the program flies high or not, not whether the program flying is tired. okay!
Now let's take a look at those non-C languages, whose strength is to improve the development efficiency of programmers. Either dynamic lists or secure lists are supported. But by adding any middle layer and any security check, it cannot be faster than (base address + offset + no inspection). There is no such thing as "easy to develop, fast to run" in this world. After all, easy development comes from layer after layer of packaging at the bottom.
Now answer the two most common questions: is it necessary to make software faster when hardware is so cheap? Most of the people who have this doubt are regular customers of Internet cafes, they understand the computer only in the computer city, they understand the computing is only games and play small movies on the hard drive. Don't play a game and have fun. Don't forget that there are full-scene simulations, 3D rendering, and autopilot.
When driving, people collect 60 different objects per second, and then make the 20 most important decisions according to the different combinations and reactions of these 60 objects. Then choose one of the more than 20 decisions to implement. So even with the fastest hardware, autopilot can't be said to drive like a human. Even if autopilot is successful, what about autopilot next? Because we prophesied long ago: why don't you go to heaven!
So: the calculation speed is never enough! Because new applications will become more and more complex and real-time. That's right! I also forgot a more important limitation: calculated energy consumption! The CPU on NASA aircraft is 32-bit at most. You may not believe it. No CPU on the International Space Station is 64-bit. I guess one of the main reasons is that astronauts don't like watching hard disk movies.
Another popular question is that
I can invent a language that is as fast as C, but there are not as many holes as C. The idea is OK, and it really happens to have this language, its name is D language, it is coincidental that not many people use it! This is because of a basic fact. There is too much, too much C code now, and most of them are working properly, just like Linux,Window,MacOS,Unix,Vxworks. You read it correctly, the kernel of these operating systems is C, although I am not sure the proportion of C in Window, but I believe that people at Microsoft will not be stupid enough to rewrite the kernel of an operating system with C #. If you want these people to use your brand new language, it's not "a little silly" and naive!
And there are some codes that we can't change at all! NASA after a simple five CPU flight control software is written, a "full coverage" test will be carried out. What happens if CPUA breaks down? What if CPUA,B breaks down? What if the CPUA,C breaks down.? You can make a simple math combination if you like. After the test, not to mention rewriting, even with a comment. Because the aunt in charge of payload will ask you very seriously, why the number of things you reported has increased, but the quality has not increased? You need to explain to her in detail: hardware and software are different. Hardware is something that feels hard, but software is not something that feels soft. Looking at the contemptuous look in your aunt's eyes, you will regret which line of notes you didn't add at this time. Don't take it seriously, this is the true story of NASA.
Why did the C language drop so much?
Quite simply, some tasks themselves are not in C language. When I was at school, I compiled a window interface in C language. Then Microsoft soon launched MFC, which is a bunch of macros that wrap up the underlying CwindowAPI.
And then the technology became obsolete. Because people at Microsoft realize that applications with windows are not the job of the C language after all, there is a danger of being exposed after another, so they invented a whole new language, C #, to take charge of this task.
The same is true of Java, highlighting the network, easy to use, secure, cross-platform. Both Java,c# and python deliberately avoid the problem of improving the efficiency of hardware, because there is no way to compete with C, nor can they shake the location of existing C code such as Linux,Unix,GNUtool. All that's left is to make a fuss about improving programmers' development efficiency. This is good for C language, get rid of the things you are not good at, and let yourself run faster!
With the rise of embedded and real-time systems, AI, robotics, autopilot and so on. These are the core applications of C language, and C language has no competitors in this kind of application. So I feel that C language will stabilize in its core application and begin to pick up gradually.
After reading the above, do you have any further understanding of why the C language is not out of date? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.