Heard people say c# for big programs, c for fast programs and c++ is just
something that failed at being object oreanting c

is c++ useful?

Failed? Seriously? Whoever said C++ was a failure doesn't know what they are talking about. Some people prefer to use other OOP languages over C++ because they are easier to work with and faster to learn (C++ has a lot of roots in C so it is not as user friendly as other OOP languages such as Java and C#).

Everyone has a different opinion. Though I haven't heard much advocacy of C over C++ for "fast" programs. Usually C is viewed as the obsolete parent of C++.

Heard people say c# for big programs, c for fast programs

Big programs cannot be fast?

c++ is just something that failed at being object oreanting c

I have yet to see anyone nail down a concrete, consistent, and agreed upon definition of object orientation that excludes C++. So claiming that C++ failed is a statement of ignorance. Further, it's important to recognize that C++ is not object oriented, though it does support object oriented features, it's multi-paradigm.

is c++ useful?

Given that C++ is probably one of the three most successful programming languages in history (along with COBOL and C), I'd have to say yes, C++ is useful.

Member Avatar for iamthwee

Is c++ useful? This statement hinges on one particular thing.

Is c++ the right tool for the job? At the end that is all that matters.

In my experience, people from a hardware (i.e., Electrical Engineering) background tend to prefer C over C++, and I suspect this is mostly because they have never had any classes on C++. These are often the same people who are writing embedded software, which is probably where the perception of “fast” code comes in. And when people refer to “fast” code, do they mean faster to execute, or faster to write?

The last few projects I have worked on combine C++ and C#. The C# is used for the User Interface and data base stuff, while the C++ does the real-time, hardware control side.

I have to strongly agree with iamthewee’s comment that the real question is if C++ is the right tool for the job.

And when people refer to “fast” code, do they mean faster to execute, or faster to write?

They mean faster to execute. The perception that C is faster than C++ is due to the fact that in the early days, C++ implementations had a tendency to produce poor object code more slowly than C implementations. That's changed, to the point that C++ is as fast as or faster than C for equivalent code, but the sense of C++ being slower hasn't.

C is also a smaller language, and people tend to view smaller as being faster.

I have to strongly agree with iamthewee’s comment that the real question is if C++ is the right tool for the job.

Indeed, any comparison needs a context, but you'll rarely find an objective comparison. Take the OP's statements. They're overly general. Usually the attacks on C++ (or any language) are emotional and made of straw. ;)

And it is VERY common for lovers of C to naturally hate the transition to C++.... They hate dem there un-necessary classes and the "convoluted" nature of classes.....

I have yet to see anyone nail down a concrete, consistent, and agreed upon definition of object orientation that excludes C++.

Well, Bjarne once defined object orientation as "slow graphics" -- but as he was being only partly serious, that definition only partly counts.

Nothing like dogging on your own language huh? lol But like Narue said back then OOP concepts were still new and because of that code was not as optimized as it is now. C++ is now used in DirectX and OpenGL programming all the time.

Nothing like dogging on your own language huh?

No, he was actually aiming at Smalltalk when he said that.

No, he was actually aiming at Smalltalk when he said that.

Ah ok that's better :D

I hope you don't listen to people who say a language is not useful-- any and every language has a use.

C++ is one of the 'big guns.' C++ has been a big gun for many years and it will not change any time soon. There is a vast amount of code done in C++. As long as C++ code remains there will be a use for C++ programmers to maintain the code.

If you want to get an idea about which languages are popular-- you can follow a site like TIOBE. They map language trends from month to month for a number of years. As you can see C++ has been in the top 3 since around 1990. That's 21 years in the top 3... it's not going anywhere.

>> Is c++ useful?

Naw -- that's why there are millions of programs written in c++.

>>Heard people say c# for big programs,

May I suggest that maybe those people only programmed very small textbook-example-style programs in C++, and then made from "big programs" in C# and found it pretty easy to do. They probably also say "big programs" to mean GUI programs. C# is a RAD language (Rapid Application Development), it isn't surprising, and expected, that people would find it easy to do GUI programs in it, and, as beginners, would be pretty impressed with how "big programs" can be developed rapidly and easily and thus, recommend C# for such tasks. There is probably some truth to it, but, generally, you should not trust some random guys' opinion. You should trust empirical evidence, or, if that is not available, expert opinion (not hear-say or random people).

>> c for fast programs

C is a smaller programming language and thus, it is often more appropriate for very modest hardware (like embedded systems). This may lead some people to think that it is faster, but that is a myth, routinely debunked. C is more light-weight and with less features. Nowadays, applications or systems that actually _require_ the light-weightness of C (or similar languages) are very rare (at least, I think..), but there is an enormous amount of legacy code (e.g. pretty much all major operating systems for example!). Under most benchmark tests out-there, C and C++ are essentially equal in speed and both the fastest out-there (with Java, about 70% slower, and the rest are far behind), see this one for example.

>> and c++ is just something that failed at being object orienting c

Well, that's a bold statement. My own impression is that, besides a few other early (and somewhat more experimental) languages like Smalltalk, Lisp, Simula, and Object-Pascal, C++ is the language that made object-oriented programming the leading programming paradigm, it made it main-stream. I wouldn't call that a failed attempt.

But, it is very important to notice, first, that now, C++ is far more the "C with Classes". It is a multi-paradigm programming language. So, if someone states that C++ is a "failure at making C object-oriented", it clearly shows that that person sees C++ as an single-paradigm OOP language (like Java or C#), which can only be the view-point of ignorance on the subject. You will never hear a knowledgeable C++ programmer describe C++ as an object-oriented programming language (as exemplified by the few experts (e.g. Narue) who replied on this thread already).

C++ sure has some shortcomings for purist object-oriented programming (e.g. Smalltalk). And it doesn't come as easy, with a steep learning curve. These are some genuine critiques, but all programming languages have problems, and I would say, C++ has less than many others, and its wide-spread use speaks loudly to that point.

>> is c++ useful?

No, C++ cannot cook my dinner!
No, C++ cannot mow my lawn!
No, C++ cannot give me a back-rub!
No, C++ cannot do my job!
Yes, C++ fulfils all my programming needs! But, maybe not yours?

Select the right tool for the job. If you think: "A chainsaw easily cuts a tree down, it must be great for cutting the grass!", then you're a fool.

commented: Good advice and tightly written up. +15

No, C is not used anymore much expect in OS development. C# is foor n00bs and c++ is used for most of the big programs, games, and other things right now. Most of the internet browsers are made it C, and most of the video games. And whoever said that c++ fails at being object-oriented is a C# n00b

C# is foor n00bs

Be sure and let him know that. ;)

@sergent I hope you done with your n00bing around on topic of C, C++ and C#.

@jonsca if mike and jon are same person, then hut off. Great work there

No, C is not used anymore much expect in OS development.

There is more embedded hardware running C code than there are PCs running operating systems. Just because you don't code in a language doesn't mean nobody does.

Be sure and let him know that. ;)

Jon is the Chuck Norris of C#. ;)

When Jon's code divides by zero, the system doesn't crash - the universe changes to allow it.

>> is c++ useful?

No, C++ cannot cook my dinner!
No, C++ cannot mow my lawn!
No, C++ cannot give me a back-rub!
No, C++ cannot do my job!
Yes, C++ fulfils all my programming needs! But, maybe not yours?

You can make a robot, program it in C++ and it will cool your dinner, mow lawn, give you a back-rub, It can do your job (AI)

C++ can do anything!

And don't get mad C people, I didn't mean it, C is still widely used language. :)

And don't get mad C people, I didn't mean it, C is still widely used language. :)

Don't try to back track now... the damage is already done... especially with that C# comment

I don't care if I hurt C#'s feelings, but I have nothing against C.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.