views:

3464

answers:

27

The more I hear and read about C++ (e.g. this: http://lwn.net/Articles/249460/), I get the impression, that I'd waste my time learning C++. I some wrote network routing algorithm in C++ for a simulator, and it was a pain (as expected, especially coming from a perl/python/Java background ...).

I'm never happy about giving up on some technology, but I would be happy, if I could limit my knowledge of C-family languages to just C, C# and Objective-C (even OS Xs Cocoa, which is huge and takes a lot of time to learn looks like joy compared to C++ ...).

Do I need to consider myself dumb or unwilling, just because I'm not partial to the pain involved learning this stuff? Technologies advance and there will be options other than C++, when deciding on implementation languages, or not?

And for speed: If speed were that critical, I'd go for a plain C implementation instead, or write C extensions for much more productive languages like ruby or python ...

The one-line version of the above: Will C++ stay such a relevant language that every committed programmer should be familiar with it?


[ edit / thank you very much for your interesting and useful answers so far .. ] [ edit / .. i am accepting the top-rated answer; thanks again for all answers! ]

+1  A: 

in some situations, e.g. for speed critical and oop, c++ may be the only option.

Yin Zhu
+7  A: 

I've really become more of a "right tools for the job" guy. I always try to learn new things, but I've come to realize that you can't learn everything, so it's no great crime to not know every language out there.

If you have a good grasp on C and can do object oriented programming well, you'll be able to at least muddle your way through C++ if you only have to use it occasionally.

In all honesty, it's a good language for working close to the metal (just as C is) and has some advantages over C, but most of us don't tend to need that kind of control. I know that, on my end of things, most of my work ends up being done in C# and the occasional script written in Ruby. I haven't really touched much C++ since college.

James Hollingshead
+25  A: 

C++ is actually considerably easier to use than C. It has high-level constructs like proper string classes, exception handling and superior type-checking, all of which make writing code easier. And many studies have shown that C++ programs tend to be at least half the length of C programs that do the same job - less code == less bugs == more productive programmer.

anon
I disagree with "easier" - more powerful, definitely, but also more complex. Also, its exception handling sucks.
David Lively
Do you have links for the "many studies"?
Jeff Foster
OK - write a C program to read a text file into an array of lines. Do the same in C++. Which was easier? And saying something "sucks" is hardly helpful - I use exception handling in all my C++ code and have absolutely zero problems with it.
anon
@Jeff Take a look at Steve McConnell's book Rapid Development. Or Brian Kernighan's The Practice of Programming. Or simply write some code in C and C++ yourself.
anon
@Neil: that's mostly a library issue and has nothing to do with the languages; and I actually don't think that you'll end up with significantly less code in C++, but I agree that development should be faster; when programming in C, I spend a lot more time thinking about how to do things than just writing code, which can be both up- and down-side
Christoph
++ Basically I agree, Neil, although I cringe a little bit at the "studies have shown" part. Whenever I hear *that* my antenna go up because often it only means "I think". Besides, I've seen *so* many projects (done in any language) that were so bloviated that language comparisons seem to be off on a tangent.
Mike Dunlavey
@Christoph You can't really write any useful code in C or C++ without using a library, so the library becomes a key issue. At least in C++ I can allocate and free memory without using a library function :-)
anon
@Neil Butterworth: Those studies are very old and imho no longer valid
Andomar
But it doesn't answer the question. Writing code in Objective-C is even easier compared to C++, because Cocoa provides such important containers as vectors/lists (NSArray) and maps (NSDictionary). It's difficult to imagine writing something useful without these. And it's a lot more pain to use such containers in C++. It's just my point regarding your answer. It doesn't answer the original question. I'd say the author "could limit my knowledge of C-family languages to just C, C# and Objective-C" if he isn't applying for a C++ programmer position any time soon.
Alex
Okay: show me how to tell **what kind** of exception happened in a catch(...) block. In *every* other language I use, exceptions descend from a common type and can be interrogated. In C++, I have to have a bunch of catch(type_A), catch(type_b), oh-crap-catch(...) constructs which *still* doesn't guarantee that I can tell what happened.
David Lively
@Alex, thanks, a good point, with languages I also (too implicitly, i guess) meant the 'ecosystem', e.g. libraries .. Cocoa surely is a library, just as Boost (as I understand) ..
chang
@Alex - uh, vectors, lists, etc are included in the STL, and they're hardly difficult to use.
David Lively
@David Firstly, you can tell what was caught in a catch(...) block, but it's not particularly useful, because you should have caught it via a specific type earlier. But what you are talking about is really reflection, which C++, like C does not support.
anon
@Neil: my comment about libraries was in regard to your example of reading a file into an array of lines; in my private code vault, that's a single function call, and in Glib, it's not really more complicated than in C++ with STL
Christoph
And now the downvotes have started - I thought we wouldn't be spared them for long.
anon
I think it *is* particularly useful, since logging what happened is an integral part of debugging. A log message like "Crap! Something broke!" is less than useful to say the least. Having to put a specific catch statement for every conceivable thing that could go wrong is, in my opinion, assinine to the extreme, especially when your response to these exceptions is often the same - show an error or fail gracefully, and exit or continue.
David Lively
catch ( const exception }
anon
@David: If your application uses arbitrary and unrelated exception classes, you're asking for trouble. If you're sane, just make all your exceptions derive from `std::exception` directly or indirectly. Or write your own exception base class and use that. As long as you don't arbitrarily decide to throw int's or `std::deque`'s, the problem really doesn't exist.
jalf
@Andomar: There hasn't been much change language-wise for C, while C++ style and libraries got better - or did i miss something and C was silently transformed into a higher-level language in the last years? ;)
Georg Fritzsche
@gf: C++ did get more complex over the years. Rapid Development was written in 1996. Back then, STL was practically unused; the first bug-riddled implementations would appear a few years later. Ofc, personally, my experience has shown even pre-STL C++ to be a horrible language. The most intuitive way to do something is often an incredibly bad choice. You can't write good C++ without reading books like "Effective C++". And what percentage of C++ programmers even opened that book?
Andomar
I'm not sure how easy it is to say that C++ is easier than C, if you're coming from the perspective of someone who's familiar with neither, or just with another C-family language. I find C++ easier to use than C, but I've been programming professionally in it for (geez) 14 years now, and been through the pain of using many compilers from the old cfront days through modern standards-compliant ones. So yes, if you know all the ways to avoid getting caught in extreme subtleties, it can be easier. But C++ encompasses so many paradigms -- template metaprogramming? Definitely not easy :).
aalpern
@David: You could create empty classes such as class TypeError{}; (where Type is what ever you want) and throw them as exceptions... When you debug your code it can be very handy!
Partial
+2  A: 

While I don't think you necessarily need to know C++ if your domain doesn't need it, I think learning C is worth it. The language itself is small and there is only one book you need to read. You will gain a better understanding of how computers work at low level and will be able to code yourself more efficient way of solving some problems, if need arises.

quant_dev
A: 

In the early 1990's, C++ was the language of choice for enterprise level programs. You could write medicore stuff quickly, producing good value.

But now, much better alternatives are available for enterprise level programs, like Java, Ruby and C#. For low-level code, C++ doesn't make sense because nobody can write stable code in C++, which is why most drivers are still written in C.

So if you can, avoid C++ entirely. It'll save you a lot of headaches at a cost of not wasting your time. One of the few true win-wins in the industry :)

Andomar
-1: Perhaps if you would understand C++ you would know the relevance of using it. Every language is suited for specific problems. For instances, I would not be writing a game in Java, Ruby or C# for that matter in the gaming industry because of how limiting these languages are. For that matter, I would not be creating a fancy interface with C++ when I could use WPF with C#... Everything depends on what you are developing!
Partial
Of course you could argue that you could do some games in those fore mentioned languages with certain libraries, but you would not be able to use the uniqueness of C++ for certain idioms and ways of applying design patterns. C++ gives one the freedom to do what he has to do, but if one does not understand the possibilities of the language it then can end in a rather horrible way.
Partial
"For low-level code, C++ doesn't make sense because nobody can write stable code in C++ ..." Just because you don't know anyone who can, doesn't mean that nobody can. Writing C++ for embedded applications has been my bread and butter for years.
Adam
@Adam: Agreed. My experience is quite one-sided: all embedded C++ apps I've seen were either restricted to standard C, or did not pass the stability tests (30 days intensive use without crash) Things might have changed since then, but it will take more than a SO post to convince me ;)
Andomar
+1  A: 

I'd get very, very familiar with C++. Even though it's not always the best tool for the job - the other .NET languages do just fine on Windows, and there are a plethora of alternatives for other platforms - it's damn near impossible to beat for speed.

It's worth noting that this isn't a function of the C++ language itself, but the available tools. For instance, out of the entire .NET suite of languages, VC++ is the only one that is compiled to native code (not considering JIT for C#, etc). When Delphi was still a player, it was the "other" language that was compiled to native code, unlike VB.

There's a reason that high-performance apps have core components, if not the entire app, written in C++. Aside from assembly language, it's the best way to get down to the metal and give yourself near total control over the code that's generated. That's difficult or impossible to accomplish with other, non-native languages.

David Lively
.NET programs can be precompiled to native code using the ngen tool in the Visual Studio SDK. This can be done as post-build actions, or as part of the install process. SQL Server does a lot of ngen compiles as part of its installation, suggesting that large parts of SQL Server are written in managed code, and SQL Server certainly stands up well in terms of performance.
Cylon Cat
Ah - I didn't know that. Very cool.
David Lively
+3  A: 

I have always foud it very useful to think of C/C++ as Scott Meyers does - as a federation of languages including: C, Object Oriented C++, Template C++ and The STL (standard template library).

fupsduck
downvote was probably because you didn't answer the question,
CrazyJugglerDrummer
Got it. Thanks for the tip.
fupsduck
+14  A: 

Ideally, you should know one C-like language, but you already do. You should know an object-oriented language, but you know two different ones (Objective-C and C#). I'd say that, if you want to learn another language for the purpose of learning stuff, go functional, and if you need C++ for a project you can learn it then.

David Thornley
++ Very sensible, David.
Mike Dunlavey
+11  A: 

The staggering volume of legacy C++ code created when it was the "flavor of the month" back in the 90s will ensure that it will stay relevant for a very long time. There is a lot of money to be made in maintaining and doing feature work on existing C++ code bases.

And, FWIW, I've been hearing predictions of the death of C++ and the rise of managed code for the past decade, at least. At the very least one has to admit it's been slower than predicted. C++ is still being actively developed (C++0x), and has had a resurgence with the "Modern C++" programming movement.

So, I'd say for a professional programmer going into the work force today, it is still worth learning. Ask again in another 10 years, though.

Terry Mahaffey
+10  A: 

Many programmers build bad designs in C++. And C++ is not easy.

Yes, C++ is horribly complex, so you may be better suited with learning plain, pure C. It may open your eyes, and maybe later you want to learn C++ (again). Or not, you'll see.

C++ is multi-paradigm, multi-anything. You can shoot yourself in the foot so easily. Its a great language anyway, but only if you know what you want to build, and if you are ready to invest deep thought in your code. The result will be control and freedom that you will never have in any high(er) level language.

You will have the same kind of control in plain C, but just in a different way.

frunsi
I disagree with everything you say, but I'll limit myself to one comment - you don't need to "invest deep thought in your code" in order to use C++. As evidence, I cite my FOSS tool http://code.google.com/p/csvfix which is basically a collection of hacks, written with very little forethought, but still useful and still easier to understand, maintain and extend than a C version would have been.
anon
@Neil: Easier for *you* to understand, maintain and extend, or easier for a newcomer to the language? You've invested a lot of time in getting good at C++. That time could have been spent elsewhere if you'd picked a simpler language.
jalf
@Jalf Not for me to say, which is why I posted the link. Obbviously, a newcomer is going to have problems with projects written in both C and C++.
anon
Yes, but it is generally much easier for a newcomer to learn C well enough to understand C code, than learning C++ well enough to understand C++ code.
jalf
@Jalf Some evidence for this assertion?
anon
@jalf: I'd say the opposite. Just for example, nearly anybody who's done any programming at all can quickly grasp the fact that an `std::string` is a dynamic-length string, usually without even that much explanation. In equivalent C code, they have to read through pages of code and basically do reverse engineering to figure out that it implements a dynamic-length string.
Jerry Coffin
@Jerry: But they will fail when they try to write something like `std::string world("World"); return "Hello "+world;`. If they'd have learned C, then they would know why this doesn't work. In C++ they have a long way to go from understanding std::string to string literals and internals.
frunsi
+4  A: 

To answer your one line question above: "Will C++ stay such a relevant language that every committed programmer should be familiar with it?" I'd say no.

I view C as the Latin of computer languages: probably every programmer should be familiar with it, even if you're from the Ruby/PHP/Python/(other dynamic language camp) because you can write extension modules from where you really need speed. So it's valuable to learn.

C++ takes so long to get anywhere near good with it, that unless you think you need it for a certain app (speed, scale of the program, destination platform, or you want to be a maintainer of C++ apps), you could use the years it would take you to be trusted-enough-to-not-shoot-your-foot-off-at-every-opportunity C++ programmer and become really good at some other frameworks and languages.

RyanWilcox
+6  A: 

The proof is really in the pudding. If you can get sufficient employment without learning C++, and you're happy with it, then keep on going on the course you're going. However, keep in mind that many potential employers may look for it on your resume even though it's not used much or at all at that job/company.

e.g. I still consider C++ one of my primary languages, but (with 15 years in the industry now) I only once briefly had a job in which it was used heavily. All my other work has been done in lower-level languages (C and assembly directly on the hardware), or higher-level languages (mostly PHP, Perl and Python). I still keep up with developments in the language, but it's not really a "core skill" on my resume anymore.

PS. I'm not terribly surprised that the link you gave was from Linus Torvalds; he's dismissive of a huge number of things that he doesn't use much. There's nothing wrong with C++; there may be something wrong with the C++ programmers or programs he has encountered, however. There's nothing wrong with using plain old C in a project rather than C++, but I would always suggest using the C++ compiler as you will gain a lot of benefits even if you don't make use of any C++-specific features (although this is probably best discussed in a different question).

Ether
+41  A: 

The more I hear and read about C++ (e.g. this: http://lwn.net/Articles/249460/), I get the impression, that I'd waste my time learning C++

C++ is a complex language, and if you don't learn it properly, it's very easy to shoot yourself in the foot. And that is also why you shouldn't listen to most non-C++ programmers hate towards C++. Most of the time, they didn't learn the language properly, so they're not really able to judge the language.

C++ has many obvious flaws. One of which is that it is so painful for beginners to use properly, or that so much teaching material (especially online tutorials) are written by beginners and do more harm than good.

You could also argue that its relevance is shrinking. In many areas, you can use a higher-level language such as Python or perhaps C# and save yourself a lot of headaches. And in some other areas, C is actually a better choice than C++ -- either because the learning curve isn't so steep (and you need to write code that others can easily maintain), or perhaps because you're working in an environment where the C++ runtime isn't easily supported (perhaps an embedded system, or you're writing an OS kernel or driver)

But there are still plenty of places where C++ is a relevant language. Sometimes because you need its strengths, and sometimes because you need to work with an existing C++ code base.

I'd argue that C++ is worth learning because it is a unique language. It has strengths that I've never seen in another language, and once you learn the language properly, it can actually be remarkably expressive and concise.

jalf
I wish people would ditch that "shoot themselves in the foot" cliche. I've yet to see an actual example of anyone doing such a thing - even metaphorically!
anon
Pointer errors? Double-frees? Memory leaks? It *is* ridiculously easy for someone who doesn't know what he's doing to make his program blow up in unexpected ways. My point is just that it is generally limited to people who haven't learned the language properly. If you take the time to do that, then you learn some very simple techniques to manage these issues. But if you haven't learned those, then your "seemingly" correct code *will* blow up in all sorts of colorful ways.
jalf
+1: I agree with you. Great answer!
Partial
@Jalf All of those apply more (or at least equally) to C than C++, surely.
anon
Many of them apply to C as well, yes. But C doesn't have many of the subtleties that make it extra tricky in C++: Copy constructors and assignment operators come to mind as obvious examples. In C, you don't have the same high-level abstractions that may cause resources (such as memory allocations) to be copied or freed more often than you'd expected (if you were new to the language). But I never said it wasn't also easy to shoot yourself in the foot in C. It certainly is. But the investment before you're able to pick up someone else's C code and understand it is much smaller than for C++
jalf
It's a misconception that C++ is not viable for embedded systems. Many popular embedded platforms support C++ quite well. I've been using C++ exclusively for embedded work for the last 6 years.
Adam
But last I checked, not *every* embedded platform has a C++ compiler available. Which is a pretty good argument for using C instead in those cases ;)
jalf
@Neil: `class BlowUp{ operator bool() const { return ..; } }; ... BlowUp a,b; if( a==b ) wtf();` - just one example where even people that learned the language think WTF? Why does comparison of two instances of BlowUp using the `==` operator work? Why does the compiler not complain? (BTW, here is why: http://www.artima.com/cppsource/safebool.html)
frunsi
Nice answer, though i'd personally add non-trivially sized cross-platform projects as a pretty strong argument for C++.
Georg Fritzsche
So as somebody who has a fair grasp of the C lanaguage and is looking to learn C++, how do I best ensure that I "learn the language properly" ?
SiegeX
+9  A: 

Will C++ stay such a relevant language that every committed programmer should be familiar with it?

no, not everyone needs to know C++. You can do just fine knowing any language if you know it well (yes, even lolcode). You don't need to know how to play soccer to be a great basketball player, even though it most definitely can't hurt. C++ is a good language to know if you are into systems programming, working with legacy C++ code, or have other need of a fully compiled language.

Will C++ stay a relevant language?

sort of C++ is and will continue to be a relevant language for a while. The only real competitors in the compile-to-assembly market are Digital Mar's D and google's go. They are far more beautiful and easier langauges than C++, mostly because they had the chance to learn from C++. Languages that run on virtual machines like C#, Java, python, obj-C and countless others are also making huge impacts as they are infinitely easier to work with. C++ is very widely used/entrenched that it will take at least a decade for it to truly fade.

using C++ vs. using C/assembly

C++ is a good mixture of speed and ease of use. I read a lot of material on C and assembly before I realized that you rarely need to go more low level than C++. Some applications that require extreme speed, like operating systems, games, and major software like microsoft office, go to the C and maybe even assembly level, because it's worth them spending extensive amounts of time to gain a few precious clock cycles. But for "normal" applications without huge amounts of resources available for development, C++ is plenty fast.

Why not just use C++ for everything?

Nowadays with processor's becoming faster, the speed of C++ is needed less and developers can have the luxury of using java/C#/objective-C/python as they can take advantage of massive libraries written in the language, work more easily cross platform, and make development "extremely* easier. :D

CrazyJugglerDrummer
-1: I believe that anyone that wants to fulfill their knowledge in programming needs to know some English. There is a lot more documentation available in English and one can discuss with a lot more people about programming. How could you possibly use SO otherwise? ;)
Partial
true, my analogy is definitely flawed.
CrazyJugglerDrummer
+1 on your comment to balance out my down vote!
Partial
updated my answer. :D
CrazyJugglerDrummer
-1 Java isn't actually slower than C++ * shock *
Vuntic
correction: games usually go for C++ rather than C/assembly (but can have parts written on those languages). examples: Source engine, Unreal Engine
João Portela
+1 for mentioning D.
topright
+4  A: 

The more I hear and read about C++ (e.g. this: http://lwn.net/Articles/249460/), I get the impression, that I'd waste my time learning C++. I some wrote network routing algorithm in C++ for a simulator, and it was a pain (as expected, especially coming from a perl/python/Java background ...).

Don't listen to any rant with that much vitriol behind it. As I recall his primary argument against C++ is that "C++ programmers aren't C programmers." Listen to someone with a well-considered and nuanced opinion on the flaws of the language instead. You'll find that they are either shared with C or entirely avoidable. Then look at what is offered and you'll find some significant improvements from C, especially over the terribly outdated ANSI C89 spec.

But a comparison with C isn't /really/ what you're asking about...

The one-line version of the above: Will C++ stay such a relevant language that every committed programmer should be familiar with it?

In 10 years the answer to this will be the same as it is now: it depends on what you need to do. C++ is relevant for situations with tight performance and memory requirements, and will most likely stay this way for a long time. Its only real competitor in that space at the moment is C itself.

In the end, good code starts with good design, and people can mess that up in any language. There are pitfalls to every language and it's important to know and avoid them. If you don't want to learn C++ with this level of detail, you should ask yourself whether you need to learn C++ for your career or general knowledge. If not, then skipping it seems like a fine idea.

Edit: However, if your only exposure to programming is "higher-level" languages, there's a lot that C and C++ can teach you. C++ might be a softer transition from Java than C as most of the concepts in Java exist in C++.

Dan Olson
+8  A: 

Before starting off, I would like to say that my answer is here to complement the one jalf wrote.

C++ is a multi-paradigm language. You could write your code in a very similar way that C would be written. Doing so would be using only a small part of what can be done in C++. You can also do some Object Oriented Programming and some Generic Programming. Of course, it can be rather frightening for someone that has never done C++ before to jump in. In fact, you can't just jump in. You might need to learn a new syntax, but the most important part of C++ is all the freedom granted to the programmer. One's code can "blow up in all sorts of colorful ways", to take jalf's expression. The understanding of memory allocation, pointers and STL can take time, but can allow some great code to created in the process like some very bad one if you do not know what you are doing.

With this in mind, I believe that C++ will remain very relevant because of the unique features you can find in it. The next standard (C++0x) will bring a rather refreshing feel to the language. For example, it will be possible to use a garbage collector, lambda expressions and threads will finally be integrated in the language. These are just a few features and I would recommend reading more about that. Wikipedia could be a good place to start off, but surely not the only place.

Another reason I can give you is that C++ can be found in many places. You might some day have a job opportunity to maintain and add new code to an already working application. One of the best reasons I could give you to learn C++ is that there are many languages that are derived from C/C++ or has been thought with C/C++ in mind such as C#, Objective-C, Java, etc. Understanding C++ will give you a certain perspective on other languages that you already know and probably the ability to adapt faster to new languages. C++ will give you a certain mindset with all the freedom you gain from it. Aside from that, you could always use the advantages of C++ and another language. Creating an application with multiple languages like C# and C++ or Java and C++ is absolutely possible.

Partial
@Andomar: I fail to see your logic... Who are you to say that there were never great code written in C++?
Partial
@Andomar: Also, who are you to say that I do not know C++? Such statements only shows some signs that you are the one who ignores what is possible with C++.
Partial
-1 to Andomar - if this was possible in comments.
Brian Schimmel
Just to explain this to later generations of readers: Andomar has downvoted this answer an commented on it because he thinks there has never been good code in C++. It seems as if he deleted his comment, but a downvote still remains, maybe from him or someone else...
Brian Schimmel
+1 from here. Very nice answer.
jalf
FYI, I didn't delete the comment, but it's no longer there. Maybe a moderator removed it or it got marked as offensive
Andomar
I would say that other newer languages (C#, Java) borrow much less (if anything) from C++ than from root languages, other than perhaps a similar object model... Objective-C is almost totally divergent starting as it did some time ago. But going forward, who will be using C++ on projects, even the improved version? That's the key question and to me the answer is not clear why you would.
Kendall Helmstetter Gelner
@Kendall: Java and C# have built upon C++ with their own philosophy. The syntax is very similar and many features can be found in each of them. Java and C# have only remove some of the freedoms found in C++ in order to have safer code. If you remove memory allocation from C++ you should find that all three languages are similar. For Objective-C, I believe it is simply a mix of the freedom of C and the safety of Java. The reason you should learn C++ is to become a better programmer. When you understand certain freedoms you start to write responsible code and make a habit of it.
Partial
@Kendall: Beside self-improvement, I should say that the language will remain because of its freedom and because it is close to the machine. That it be for embedded systems, military purposes, video games or just even for application maintenance, a language of the sort will be required. For one, I will be someone using C++. Although it might be hard to start off with it, it remains a valuable asset to anyone who is willing to take the time to learn it.
Partial
+1  A: 

If you are planning to develop video games, C++ is probably a must. If you are planning to develop something else, there are probably better alternatives: - C for low-level system stuff / Linux development; - C#/Python/Java for everything else.

C++ is a nice language, but it will take considerable amounts of time to master it. You'd better use the precious time to do something else.

Andrei Ciobanu
+2  A: 

C++ can be a very good language to know, but in any case I'd start with plain C. C is small enough to be able to learn well with a few weeks and a good book. Once you've built a really good grounding in it, then try moving onto C++ - you'll appreciate and understand the additions it's made to the language rather than approach it as an entirely new language.

I prefer C - that's just my personal opinion. I've found that C++ can add quite a bit of bloat, and can get very messy with larger applications. The same holds true for C, but it's a lot smaller and nicer to work with. My personal opinion.

Jamie Rumbelow
if you learn C first, then it's likely that you'll bring some bad habits, such as char**, with you to C++
lhahne
Sure, but you will have the benefit of actually understanding how strings work at a lower-level. The string class hides that from you in C++ (well, most languages)
Jamie Rumbelow
+4  A: 

I'm surprised to hear that from someone who does Objective C... I did C, C++ and C# before and I'm totally unwilling to learn Objective C, so exactly the other way round than you.

But maybe this isn't too surprising, and this is because C++ and Objective C try to fill in the same gaps of C. They do it just in other ways, but do not solve many problems that are unsolved by the other. In that way, they are redundant, and which ever you learned first, you are kind of doomed to hate the other one because it feels so different, and yet does the same.

C# does not really fall into this. As a managed byte code language, I don't see it as a part of the C family, rather something like the MS way of Java.

Concerning the relevance of languages in practice, C and C++ are everywhere, and C# seems to be just everywhere where Microsoft is, just as Objective C is likely to be seen where Apple is. Because both Microsoft and Apple are smaller than the rest of the world, I can hardly imagine C and C++ losing their relevance.

On the one hand, it's always good to know one more language, and if its one of the most widely used ones, that's even better. I would even say that C++ is the most widely used, but others will tell you it's C or Java Script or Java or Fortran... On the other Hand, if you like C, Objective C and C#, and know them well, that's enough for most purposes, and I think no one should learn a language he clearly dislikes.

On the other hand, you might even like C++ if you give it a real chance. You said you were using C++ in one project, and it was a pain. I've been using it in several projects and it was a pain, but that was because of the constraints of those projects. I had to use APIs which were ugly and prevented me from using the newer aspects of C++. At first it felt like C++ was the problem, but once you get the chance to experience C++ in a clean environment, it's really fun.

Brian Schimmel
A: 

C++ is still better for the most part because there's so many little things to make life easier, but it's certainly a lot more complicated. Usually in unnecessary ways. If you listen to the STL/design patterns fans you will wind up with the problems Torvalds complains about, and fix them with even more complicated 'solutions' ad nauseum until you have a horrid mass of garbage that takes days to compile and would take a lifetime for someone else to comprehend.

Charles Eli Cheese
Just plain wrong. But I didnt downvote.
John Dibling
A: 

Will C++ stay such a relevant language that every committed programmer should be familiar with it?

I don't believe there is anything inherently so valuable in C++ that every committed programmer should be familiar with it(though it is useful to know some C-family language). However due to performance reasons in certain applications and huge amount of legacy code it is relevant language and will likely remain so for quite a while.

Seems to me that the question is to what you want to concentrate as a programmer. Also consider that based on your question you aren't happy about learning C++ so maybe it would be more productive to learn some language/technology/platform that you are excited about. From practical point of view there are quite a few jobs where knowledge of C++ isn't required and to me it seems unlikely language of choice for a startup(naturally it depends).

Illotus
+2  A: 

Will C++ stay such a relevant language that every committed programmer should be familiar with it?

Yes, C++ will stay a relevant language, and no, not every committed programmer should be familiar with it.

Nemanja Trifunovic
+3  A: 

The one-line version of the above: Will C++ stay such a relevant language that every committed programmer should be familiar with it?

In many domains, it is more relevant that C. If you found C++ a pain compared to C, then you were doing it wrong! C compared to C++ is like a fighting with one arm behind your back. You should realise that you do not need to use all of C++ to use it effectively, and that C++ is more or less a superset of C, so is all of C them more. So why restrict yourself to a smaller toolbag, when you could have a big one, and simply use the tools you are comfortable with - you will start to use more of them as you get more comfortable with them.

That said, Objective-C is the path of least resistance for OSX development, while C# is the easiest path in Windows. But neither of these provide the level of cross-platform support available with C++, which is available on most architectures including 8 and 16 bit devices.

Clifford
Its worth mentioning that its relatively easy in comparison to interface cross-platform C++ backends / application cores with those platform-specific languages.
Georg Fritzsche
+3  A: 

Will C++ stay such a relevant language that every committed programmer should be familiar with it?

Familiar? Yes. Able to program productively? Not necessarily.

Avoiding C++ will limit your choices, but not so severely that you can't find work. At this point I view C++ as an important legacy language. Brand new C++ projects are started primarily by those who don't know better or who have mistaken beliefs about performance. But compatibility with existing code remains an excellent reason to choose C++. For example, you might want to use the superb QT graphics/UI library, and C++ follows as a natural choice.

That said, like other important legacy languages, C++ is not going to go away any time soon. As much as I myself go out of my way to avoid C++, I think young programmers are well advised to become minimally competent. And if you want to work for Google or Microsoft, fluency in C++ is a significant advantage.

Norman Ramsey
+1  A: 

I don't think there's any language that "every committed programmer" needs to know, for the following reasons:

  1. When it comes to practical value, i.e. usage to solve real problems, people tend to use different types of languages depending on niche. If you're an embedded programmer, you probably don't need anything higher level than C, or maybe C++. If you're a web programmer, you probably don't need anything lower level than Java. If you write server backends that must have both super-high reliability and scalability, you probably won't use anything but VM languages (like Java, C#). If you do scientific computing, you probably have no use for any language that doesn't have good support for either numerics or string processing.

  2. When it comes to pedagogical value, paradigms and styles are much more important than specific languages. You might want to learn a language that allows unchecked, low-level programming, but it doesn't much matter whether that's C, C++, D, Delphi, or something else. You might want to learn something about assembly language, but the specific architecture is less important. You might want to learn a strongly OO language, but it doesn't matter much whether that's Java, Smalltalk, or Ruby. You might want to learn a functional language, but either Haskell, Erlang, or OCaml will get your brain into "functional" mode reasonably well. You might want to learn a highly dynamic language, but Ruby, Python, Groovy and Lisp all fit the bill.

dsimcha
+1  A: 

I'm currently reading my way through Coders At Work, and what struck me there is that of the 13 or so programmer-interviews I've read so far, no one has talked about C++ in positive terms. Then again, Bjarne is not among them.

JesperE
A: 

Read more about it from a C++ guru here: http://www.cantrip.org/realworld.html My advice to you is that, use what ever tool is the best to solve a given problem. Learning is good and more important is that you need to have right attitude while you learn and apply techniques in the real time scenario from the things you've learnt. C/C++/Python/Ruby/Java it doesn't matter. All that it matters is that how to solve a problem. If you know that selecting a programming language based on the architecture, dev tools for the architecture etc decides C/C++/java/python etc.

C++ is good to learn & C++ is every where. Most recently I read below article:

http://lwn.net/Articles/286539/

There is an effort started/approved by GCC commitee to write certain portions of GCC compiler in C++. C++ is here to stay & I look forward very much on the C++0x features to be officially added to the widely available C++ compilers soon. Yes there is a learning curve & it's huge for C++. But if you learn it & learn it in the right way with right attitude - what i mean by right attitude is that have an open mind while you learn and try not to compare programming languages. It's bad and effectively you'd end up learning nothing almost.

placidhacker