Haha, you obviously have no idea how a compiler works and what the difference is between a compiler, an intepreter, a bytecode and a JIT compiler.
Anyway as someone way above stated very clearly C will always be used for low level stuff, kernel and drivers. C and not C++ which has nothing to do with C whatsoever. Furthermore if you want speed or small code you use C, not C++ and all the mess it generates with classes and stuff.
FYI ā there is now post-tension concrete that actually makes concrete harder because it is compacted. also, there are different grades of concrete, the best using ash that strengthens concrete over time. it just goes to show the old saying is true: garbage in, garbage out.
C and C++ will always have their place for writing core libraries. and iām a lot more comforatble managing my own memory (until i get Alzheimerās) than some new-college grad thatās never heard of pointers. Even MS developers donāt trust the garbage collection in the .NET languages. (i canāt find the post right nowā¦)
āBut when was the last time you used C++ to write a line of business app or website?ā
Hmmm. I guess that would have been last Friday, January 12 2007, when I was writing code for flight software application at a major aerospace corporation. For some odd reason, we arenāt converting our insanely huge C/C++/Fortran codebase into Java, D, Ruby on Rails, Python, Perl, or whatever the current flavor-of-the-month language isā¦
Iāve been coding for about 20 years, in all sorts of languages. Assembler, Java, Smalltalk, JCL, REXX, C, C++, C#, Shell, Pascal, Perl, PHP, Ruby, TCL, Eiffel, Maple, Mathematica, Gaussā¦god knows what else, even VHDLās for FPGAās. Let me say that C++ is pretty great, and infact is what Iāve chosen to use for a number of new projects.
Here are some comments on assumptions on points above:
Many assume āhigher level languageā needs to be āslowerā. Thatās just not true at all. That said, if itās slow in C++, itās likely your algorithm, while if itās slow in a high level language, itās probably that youāre using convenience classes that are poorly suited for your problem domain.
Itās true that a lot of programmers arenāt formally trained anymore. If a programmer canāt work out time complexity between a Quick Sort and a Bubble Sort (really basic questions), I donāt hire them. Even if theyāll be using a high level language. Iāve seen hundreds of thousands of dollars go up in smoke because programmers honestly didnāt understand why the Java ArrayList behaved so poorly when used as a queue, and the queue size grew. Actually, change that: millions lost. High level langauges should be used for their expressive power, not as a crutch for people who shouldnāt be programming commercially. Itās ilke the comment above, āyou donāt know when youāre hitā.
Many high level languages are compromising in areas they shouldnāt, letting programmers be lazy. If thereās one problem with coders in high level languages, is that they donāt seem to write much āerror checkingā code. If something like VB or C# had Design by Contract built in (like Eiffel has) forced as part of the language, Iād be happier. I do know about Spec#, and other C# DBC extensions. Really, the language should be easy to use, but also do itās bit to enforce some quality.
Vistaās way slow. I played with it yesterday and I could see delays in the icons on the start menu popping up. Itās pretty pathetic. If I were Microsoft, I wouldnāt be proud of it.
C# is a nice language. Iād rather people learn Smalltalk tho. Squeak is cool.
Only in the last three years have I spent more time with C++, and Iād have to say itās a pretty excellent language. C# is cute too, but itās performance isnāt there. I wrote a test system in C, C#, and Ruby the other day. Ruby got 11,000 operations/sec, C# got 34,000 operations/sec, and C++ got 71,000 operations/sec. The C++ code compiled on Windows, Linux, and BSD without any warnings or code changes. It also used the least RAM.
Fast? Portable? CPU and Memory efficient? Do these things matter to anyone?
If you canāt handle the power, just steer away from it. Donāt badmouth C++ because of your inability to use it correctly.
I donāt know, maybe itās just that I donāt like to be kept in a little box that protects me from the real world, but I prefer using C++ over all these languages whenever possible. That said, I do think that some languages are more suitable for some tasks.
Citing Bjarne, āIndeed, one serious problem is that currently, too many software developers are undereducated and undertrained.ā Just go to www.thedailywtf.com and youāll see that most posts come from Java and VB āprogrammersā.
Iām wondering why people seem to think they can optimize code better than a mature optimizing compilerā¦ In general, itās best to let the compiler do the work.
I also keep going back to the last point on the original post: which language best protects against human foibles? My answer would be the language that is the most readable and maintainable (good examples being Ada and Python). Almost all code will be read many more times than it will be written, and any long-lived system ends up with about 10% of the total cost in the development phase, and about 90% of the cost in the maintenance phase. Draw your own conclusionsā¦
āThe CLR will eventually destroy the class and force the connection closed, but you have no guarantee when the garbage collection on the object will actually happen.ā
One of my first Computer Science instructors told me that anyone who is a solid C++ programmer knows how to program and can pick up any language out there. This has held true since I heard it 10 years ago, with perhaps the only exception being Lisp (my favorite language to play with), which many OO programmers have issues with.
The reason C++ is a good language is because it makes better programmers of us all. From low-level understanding of how the machine works by figuring out how pointers work, to high level understanding of how objects and inheritance work, C++ covers it all. After spend 2 days trying to figure out why your program keeps saying āSegmentation Fault (Core Dump)ā, you learn/understand the importance of memory/pointer management. Struggling to write a linked list, and then learning about the STL makes you realize how important reusable code is.
Sure C++ is very difficult to learn and understand, but once you do, you have top to bottom knowledge and understanding of how a computer works. For all its faults, C++ should be a language every programmer has in his/her toolkit.
Daniel: You can code cross platform with C#, Mono has come on leaps and bounds. You do have to put the extra effort of making sure your code is fully compatible with Mono and that you donāt use anything windows specific. You donāt get anything for free
Jeff: I whole-heartedly agree! C++ is a great language for hardware interaction or even for making a component that has a need for the most performance possible, but its power and flexibility means you have to take more control and responsibility over everything. More recent high level languages like C# take some of that power and flexibility away, but with less under your responsibility to directly control your productivity is greatly increased and the language/framework can protect you from many common mistakes.
But alas, whatever the language, there will always be cases of ā(accidental) use of the ordnance to hurt yourselfā.
Some languages protect you more, many protect you less, but incorrect code is always incorrect code.
thereās a new language out there released just a couple of weeks ago called āDā. It offers performance and flexibility of C++ and high level features like garbage collector. Syntax is very similar to java and c#.
Is it just me or has the bitchiness level on this board has gone up considerably in the new year? Jeff writes an entry on Vistaās search feature and everybody and his brother jumps down his throat for being pro-ms.
He runs a post about C++ and itās relationship to newer languages and all the C++ people flip out and kick in condescending overdrive.
āProgrammer lazinessā is the dumbest phrase I hear on posts these days. The fact is you can get considerably more done in a given amount of time with the ācuteā languages like C# and Java than you can with C++ or C. Itās easier to recruit or train people in them to maintain the code. If you are writing an application that lends itself to such a language/platform wtf would you not use it?
I donāt suppose any of you non-lazy types would bother to go to Ikea when you need a new coffee table. I bet you head out to the woods to chop down some trees and assemble it yourself. Damn youāre cool. Iāll just sit down with my lazy-self, kick my feet up on my new coffee table and drink a beer while you ārealā programmers are off in the woods fighting with bears and chopping down trees (no chainsaws, just axes).
Of course you wouldnāt rewrite all your legacy apps in a new language that makes no sense. Writing a whole new business application in C++ when C# or Java would do just as well? Well thatās just a waste of time and money.
So C++ was a step in the wrong direction if you want a general-purpose programming language. For most tasks itsā complexity is harmful.
Still, new mainstream-languages like Java and C# adopt the C and C++ā syntax, the type system, and control structures. Maybe it is time to realize that all languages that stems from C are broken?
āOne of my first Computer Science instructors told me that anyone who is a solid C++ programmer knows how to program and can pick up any language out there. This has held true since I heard it 10 years ago, with perhaps the only exception being Lisp (my favorite language to play with), which many OO programmers have issues with.ā --Bill
Iām glad you mentioned this. Maybe itās just me but I donāt sense that Bjarne values productivity. If you can do C++, youāre going to be able to spit out an web application using Ruby on Rails or ColdFusion in no time. But if you try doing it in C++, chances are one of these non-highly-trained-programmers are probably going to crank something out before the master C++ person. Itās almost like heās arguing an experienced plumber should keep welding copper pipes together instead of using those fancy sleeves where they can just quickly crimp together 2 pipes. Itās important to know the basics but donāt run away from productivity lest you want to be out of work and out of business.
TheGeoff, so you donāt agree that there is an increasing number of undereducated programmers, and that this is caused mainly because they are getting accustomed to have important tasks done for them? Read what Bjarne said in the quoted snippet, itās all true.
Like Bill Watts said, competent C++ developers can be competent in other languages quite easily, while itās not true the other way around.
Iām not saying I hate languages like C# (but yeah, I truly dislike Java and VB) but Iād say itās healthy to remain competent in languages like C++. It actually seems they put time to design C#. But if youāre into the Managed stuff, Iād recommend getting into C++/CLI.