by betterunix · 13y ago · 0 comments
Oh yeah, let's put Chromium, Firefox, and all of KDE on that list too.
As a person who is proficient in both C and C++, I find this constant war ridiculous. Neither languages are obsolete ok? Which one is best for you depends on the circumstances. Stop speaking in absolutes.
As for C it is a great language but it is pretty much only for either old stuff or system level stuff. In the real world I see people pick C++ over C if possible.
Maybe so, but the programmers I know who have switched from C++ to Haskell/OCaml/F# never seem to regret it. They are getting more done in less time, and spending a greater fraction of their time writing good software than tracking down annoying low-level bugs. The small trade-off in performance does not seem to be an issue, and in the few places where it is, some C or assembly code invoked via an FFI solves the problem.
"C++ is still one of the most flexible languages for application development"
Only if you are not counting the overhead of actually getting a complex C++ application to work reliably. Even the new abstractions in C++11 and C++14 seem to force programmers to deal with low-level issues than in almost every case are a distraction from the high-level problem being solved.
All languages make tradeoffs. You need to understand your domain and the tradeoffs associated with them.
If you're doing any embedded programming you're going to be using C. C++ is pretty much exclusively used in the gaming industry, and there mostly because of historical reasons more than anything else (all the popular frameworks are written in C++).
I'm curious how you've come to that conclusion? C++ is used in most of the major web browsers, most of the major database engines, most of the major office program suites, it's widely used at Adobe, Microsoft and Google... C++ is in the top 5 of most language popularity rankings (TIOBE, langpop).
Sure, C++ has its issues, but claiming it's only used in one industry is way off base.
As for office suites, there's three of them out there, MS, which is C#, Apples which is ObjectiveC, and LibreOffice which so far as I know is Java.
I wouldn't be entirely surprised if a lot of the DB engines are done in C++, but I also would expect quite a few of them to be done in C as well. DB engine is a rather specialized area that demands the best performance you can possibly achieve, so something low level like C or C++ is to be expected. In order to achieve top performance you need to sacrifice ease of use so a really basic language like C or C++ is expected.
Interestingly enough looking at the source code for Firefox there is indeed some C++, but there's actually a lot more JavaScript in the Firefox source tree than there is C++.
The answer to that question, IMHO, is yes which is what the OP wanted to know. Had they asked what languages they should learn I would put other languages above C++ but that wasn't their question :)
It's likely that your idea of what is 'inherent' to C++ is just wrong. First of all, C++ is almost a superset of common C so, yes, it can can really replace C entirely and completely. Whatever grievances you have with the language don't change the reality that even embedded code benefits from, and has been gaining ground in, C++ for quite some time.
In any case, I'm not arguing C++ is inherently 'better' than C. I'm just saying betterunix's assertion that C++ is somehow 'legacy', and C somehow isn't, is weird and illogical.
We do still have a need for a low-level language; C is not the greatest language but it gets the job done. There is also quite a bit of C code out there, proof-of-concept code, reference implementations, etc., and so not knowing C means being cut off from all of that. C++ is not as commonly used for such things, or if it is then only a minimum subset of it is used, and it has no advantage over C as a low-level language. The high-level features of C++ are polluted with low-level concerns that serve as nothing more than a distraction; this has not changed with C++11 and it does not look like it will change with C++14.
So really, the only good reason to be learning C++ in this day and age is if you need to extend or maintain some part of the massive body of already-written C++ code. In other words, if you need to deal with legacy code.
For example, AFAIK you cannot have a naked struct in C++. A struct is a class, and therefore can have methods, thus can have constructor and destructor.
Also, exceptions are a big part of C++ that I don't think you can remove?
If you want simple, obvious separation of data and logic, and you don't want exceptions or name mangling, then C is probably a better choice for that domain.
I like C++, but it is not C and is unlikely that one will ever replace the other in all the domains.
OTOH, if you want to write OO and you like C++, then it is not a bad choice.
I think both are being used to write new systems, so neither is legacy :-)
Now only you will truly know if C++ is suitable for the tasks you do but unless you work at a university then chances are C++ will be good to great for whatever you need.
"I am already familiar with C, as well as Python, Go, Java and a few other scripting languages."
In terms of relevance in the real world, those languages cover pretty much all bases. The only reason I can see for learning more languages would be to learn entirely new ways to think about programming i.e. different paradigms. Functional programming is fine as far as that goes, but constraint programming is even more radically different (it is not likely to be viewed as simply a "style" of programming that can be used in C or Python), so I mentioned it.