C language is dead, five reasons to forget it

Source: Internet
Author: User
C language is dead, five reasons to forget it
My self-reportI post this article to demonstrate my support for this article.
Nowadays, many C/C ++ programmers are always arrogant and look down upon other developers. In fact, others may look down on him more!
I was also fascinated by C/C ++ in the age of students, but today, I have never been able to write impeccable C ++ code, so I always think that I will not C/C ++. Over the years, I have been searching for the best mode to write c ++ code. However, to be honest, I have never seen any good C ++ programmer or the code written by very good. C/C ++ code is always ugly and has bugs! Author: Ed Burnette, compile Li an Min [51cto.com exclusive special article] I have been programming in C language for more than 20 years. I have written C language compilers, C language debugger, other languages developed with C, games, client programs, and server programs! I have never written any more. And my bookshelves are filled with K & R and Steele books. I know the C language too well, but I hate him. Very annoying! When I read a blog titled "Why should every programmer learn C language ?" I am really goose bumps. If you are a professional programmer, you must think this is a big joke, although the author's intention may not be like this. This refuted article is a bit interesting, but still does not grasp the essence. So I expanded it. There are five reasons to explain why programmers who use C language should not only use other languages, but also forget the annoying things they are learning C language.1, Memory allocationI can write a whole article about this. Maybe I can write a book, or even write so much content that can be filled with library technical books. Memory Allocation and storage unit allocation are indeed very troublesome. You need to allocate too little memory, or allocate too much memory to waste. The question here is: How to initialize it to zero? Or simply don't initialize it. However, the initial step is to release the memory. All the existing toolkit will help you confirm whether you have released the memory allocated for each bit, whether you will never use it after the release, and will stop you, never release it twice. What's more, memory allocation and memory release are both slow and slow in the C language. When using memory allocation, I really don't want to think about the special situations that need to be considered. As long as the problem (object) size is appropriate, I prefer stack space or pre-allocated structural space. If I do this, I will have more troubles. Again, the man who invented the spam should have won the Nobel Prize.2MultithreadingI used to like C language, really. Until I start to develop and maintain multi-threaded servers with C. In terms of protecting data for conflicting threads, the C language does not provide programmers with a little help. Every intuition and experience you gain when using a single thread is wrong when using multiple threads. At least Java has memory for keywords indicating synchronization and proof files (but a strange file), but even so, unless you use the new javax. concurrent, otherwise it will only crash in front of the massive parallel machines. Return to the C language: in a simulated production environment, debug a deadlock in the data center for a week (this has actually happened ). Java only needs Ctrl + break! Oh, my God !!!3PointerPointers are too difficult to control, so they are too sinister. I don't even have a way to describe them. Every year, I spend several months debugging strange pointer problems every year. I used to try to get all the secrets, such as unintelligible constructor, Consortium and offset, reuse the last two tags, and all the other tricks. But I find that this is not worthwhile at all. Static references in other languages can be solved.4Early Optimization Speaking of tricks, have you ever wasted brain cells to study* Is P ++ faster than P [I? Have you ever spent time trying to make some changes to replace multiplication, or try to make the inversion in the loop run faster? Still worried about the speed of passing a parameter and adding a structure against it, and the speed of passing it? Stop! Algorithms are the key to speed. The programmer's level determines which algorithms he will use. Knowing this can make your program better, faster, and reduce your head's muscles. Well, there are some examples that can be done in this way ...... No, you just need to stop doing that!5, Test Your favoriteCWhich of the following is the unit test tool? Hmm...I cannot think of one? Unit Testing is definitely not important at all, right? It may be too troublesome, difficult to keep up with the progress, and a waste of time. You can use this time to make it take up only the work time.1%Which is more suitable. Or in the data center, debug the problem caused by only 100 simultaneous online users through optimized unlabeled images.I should have gone on with some other reasons,5Now it's enough. After that, it feels better now.CIt used to be great....That is in1984Year. Until todayCI was pleasantly surprised by the new code I wrote....If you make me compare, I think C ++ is just a little better than C. If you want to learn some older languages, try forth, Lis, or APL. These old-fashioned languages can at least teach you how to think about your programs in different and elegant ways.Author Profile 

Ed Burnette is a programmer with rich programming experience. He is now dedicated to developing OLAP clients and servers using Java and C. He prefers to study Java, eclipse, and open-source software in his spare time. He has written many articles and books about eclipse, and he is also the editor-in-chief of eclipsezone.com. Source link: http://blogs.zdnet.com/Burnette? P = 208

 Original article addressHttp://developer.51cto.com/art/200612/36506.htm

 

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.