Skip to content


Why C++ is better than all those other kids

There was a post on Slashdot today that got me going. Not really the post, as I found the question that it asked quite interesting, but it was the responses that got me riled up. The question was about libraries that essentially took out the need for #ifdef declarations in C++ for multiple platforms. Now, I will tell anyone out there that this is impossible to get rid of; there is always somewhere in your code where Microsoft or Apple chose to do something differently than each other, or the ‘Nix fellows chose a different path to go down with their implementation.

The talk on the comment threads that I found frustrating was the seeming ignorance about C++.  You see, there seem to be people now-a-days that simply don’t know C++, but they know of it, and make judgement thusly.  Or, they had C++ in highschool, so they think they know it.  Or they chose to teach Java to their kids in College, instead of C/C++ (I think I’ll talk about why that’s a horrid idea tomorrow).  But what these people where saying basically that C++ isn’t cool anymore, isn’t even all that useful.  The truth of the matter though, is that until something that does the job just as quick, but takes less time to program with comes along, C++ will reign King of the programming languages.

So, why do I put it on such a high pedestal?  Well, lets compare.  Java is rather slow (barring paying near Oracle level fees for a highly optimized server package).  There’s also things that you still just can’t do in Java that you can in C++, whereas anything that you can do in Java, can be done in C++.  Python?  Don’t get me wrong, I love the kid, but it’s even slower than Java.  And not really built for the same tier of applications.

But what about the web sort of app?  Well, realistically, I could certainly build a web application written entirely in C++ if I wanted to, and it would run faster than any PHP, Python, Java, ASP.NET, and certainly Ruby application out there.  And that means that I don’t have to worry nearly as much about performance.  There’s even a C++ web toolkit, explicitly for building these sorts of applications.

Now, I’ve gon through all this trouble, and there’s only one problem: memory.  As you very well know, you have to manage your memory in C++, and this is where a bit of time is added to the development process.  There’s tools out there to help though, and they really are quite spectacular.  The one that I use at work at least is Rational’s Purify (IBM now), and it works quite well.  In the open source way though, there’s Valgrind, but that’s only available in Linux environments.  But if that’s a problem for you, then you may need ask yourself why you’re developing an (most applicably web) application on something else.

Be Sociable, Share!

Posted in Programming. Tagged with , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.