C++. The thinking man's language?

Sometimes (quite often actually), I see C/C++ gets bad press and I read
things about Java and C# about how wonderful (and easy) they are compared to C++.

Ok, C++ may be a bit Heath Robinson and sometime archaic and weird, but that's what I like about it.
You have to think about what you're doing.
Indeed. I have seen lots of people who say that just because they think "it's harder." Also, this:

Other advanced features include pairs of keywords which look totally different but do almost exactly the same thing and having some keywords that get used everywhere to do a load of totally different things.

It is obviously better than C, but most people are too feeble-minded to learn it, and usually die of an aneurism when they begin to learn how to use templates. Given the complexity of the language, only the best programmers can actually use it, and because of the necessary skills, the programs are always smaller, faster, and better than programs written in other languages.


Gotta love Uncyclopedia...
Well, Bjarne once said that there are two kinds of languages: those everyone complains about, and those nobody uses.

I think people that criticize C++ but favor semi-compiled languages such as C# or Java are the kind that don't C++ in their line of work, anyway. For example, in web, or embedded applications. C or C++ wouldn't really be that useful in those context, so their criticism is right in that sense. They're wrong in that they're criticizing a tool for being useless for something it wasn't designed to do. C was designed as a sort of portable Assembly and is used mainly in systems programming. C++ adds other stuff to those main principles of portability and efficiency, mainly, multiple paradigms.
Programmers with the mindset "programmers are expensive, hardware is cheap" hate the kind of bureaucracy C/++ demand, and they're probably right. Most applications for languages like Java are not high performance, and if for some reason they were running a bit slow, its cheaper to just add more hardware than to optimize (it's not like there's much to optimize, anyway. You can't just move stuff to the stack, or anything like that).
Of course, you can't have an entire system based on Java. SOME part of it is based on a lower level language, and that's were C/++ really shines. There are problems where just adding more hardware is not a viable solution, and instead require a little tweaking on the part of the programmer. A good -- if tired -- example, are games. Could you imagine if the the Crysis development team had thought "hardware is cheap" (something tells me they did, but let's leave that aside)? How about an operating system, a driver, or just about any low level interface with that as its motto? Any system written like that would grind to a halt after a few minutes.

So the bottom is line that is true that C/++ cannot solve every problem (cheaply. They are Turing-complete, after all), but the same is true for every language. "The right tool for the right job", even if "every tool can be used as a hammer" and "when the only tool you have is a hammer, every problem begin to resemble a nail".

Of course, there are also those that hate C++ because it's cool (yes, there are circles where this is true), even if they never touched it.

EDIT: I mean "because it's cool to hate it". They don't hate C++ because C++ is cool.
Last edited on
Agree with the lower level part... I like C/C++ because you're less abstracted from the hardware level and can gain an appreciation for how things actually work instead of blindly (and sometimes bluntly) using some higher level library or language to accomplish your means.
Last edited on
Let me give my appreciation for C++, which I think differs a little bit in flavor.

I like C++ because you write the least amount of code in C++. Programs are simply shorter in C++.

That statement is exactly opposite to what people would usually cite as an advantage of a high level languages (it was meant as a shocking statement). Let's look at my case.

I was writing my mathematical software originally in Visual Basic for Excel. Now, I need all kinds of polynomials - polynomials with int coefficients, polynomials with rational coefficients, polynomials with coefficients in cyclotomic extensions of the rational numbers (in other words, rational numbers with addition of the complex roots of unity http://en.wikipedia.org/wiki/Root_of_unity ).

And then again all of these on the condition that the coefficients exceed the usual size of the int. My polynomials are in more than one variable, and get huge pretty fast (the current expression I am working on is about 150MB large with the C++ realization), so for the whole thing to function, I must represent everything with hash tables.

I found myself copying and pasting code for weeks in Visual Basic for excel, just changing the function "AddRational" to "AddLargeRational", and the function "HashWhatever" to "HashWhatever". Now one could say, I could make some wrapper class for all my algebraic structures, make a variable indicating with which algebraic structure exactly I work, eventually slowing my program by a significant factor, and in practice dynamically emulate template classes

Or I could switch to C++. There everything was already done for me: template classes, polymorphism, name it. Someone would say: "Hey, but you lost all the input/output flexibility and all the infrastructure that Excel offers" (Excel is very handy for quickly modifying integer valued matrices, for example). To that I answer: it took me a couple of weeks to write for myself some basic programming infrastructure, and maybe I even rediscovered the wheel a couple of times. The time I lost was 1/2 of the time I lost copying/pasting code in Visual Basic for Excel.

The time to (re)write some basic routines anew is negligible when you have a tough task to handle. You can redo all the fancy stuff that other languages offer in weeks. And then the time invested pays back quadruple!

Oh, and one more minor detail: actually speed of execution sometimes matters when computations take several hours on an average example (such as my current one). And there are *large* examples, you know.
Last edited on
Is that the source you were talking about in http://www.cplusplus.com/forum/lounge/10951/ ? I would like to see it.
What did you run it on, and what was the input?
Also, did you consider using arbitrary precision numbers? They're much cheaper than they used to be.
Last edited on
closed account (S6k9GNh0)
I picture C/++ as a heavy duty language made for effeciency. The mother of languages. ASM would be the Big Daddy in my view. And then Binary would be the Grandpa that no one wants around since it has no use in our world. >.>
Last edited on
Topic archived. No new replies allowed.