Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
2.60/5 (5 votes)
See more:
Hi,
I have been told by many Seniors to switch to C++ despite the performance of C++ code is not faster than C. And also I was told that C++ is not necessarily faster than C but still they suggest me to move onto C++ than C.

But is this really true. To be employable are they saying it this way?

I know OOPS is a very good concept, then why not they suggest to move onto Java or C# or .net. Why only C++?

I still see that C is considered an alternative to assembly language these days.
But I aspire to be a low level/Systems level developer.

C is still the best choice for implementing low level stuff.

Please suggest.
Posted
Comments
Sergey Alexandrovich Kryukov 2-Aug-12 16:18pm    
A lot of incorrect questions here...
--SA
enhzflep 2-Aug-12 16:21pm    
Since C++ is a superset of C, if you can program in C++ comfortably, you'll find it easier to then write C code than if you were a C coder trying to write some C++.

Java or C# or .NET are all fundamentally different to C++ behind the scenes. C++ has no garbage collector - the others all do. C++ also has lower system requirements that any of those. Mem/speed/diskspace

C is still the best choice when the system precludes the use of C++ for low level stuff.
pasztorpisti 2-Aug-12 16:32pm    
C++ is today's "high level assembly language". :-)
[no name] 2-Aug-12 16:39pm    
Yes it is a High level Language :)
pasztorpisti 2-Aug-12 16:49pm    
Hey, we discussed this in another topic! :) If you don't use polimorphism and exception handling then all the rest from C++ can be compiled and optimized just like C code, plus you get a lot of benefits and a more nicely structured code and resource management.

There is no "better". Thus you can not objectively say C++/C is better.
It depends on what you're trying to do (try to use the language which suits best for your project).

But do not forget (!!!!!) that today's C++ is a multiparadigm programming language, one supporting a combination of procedural, object-oriented, functional, generic, and meta-programming features. This power and flexibility make C++ a tool without equal, but can also cause some confusion. All the "proper usage" rules seem to have exceptions. How are we to make sense of such a language?
Not so long ago there was a new standard for C+ + (http://en.wikipedia.org/wiki/C%2B%2B11)

To make sense of C++, you have to recognize its four sub-languages:
* C. Way down deep, C++ is still based on C. Blocks, statements, the preprocessor, built-in data types, arrays, pointers, etc., all come from C. In many cases, C++ offers approaches to problems that are superior to their C counterparts
(C formerly called "C with classes" )
* Object-Oriented C++.
* Template C++.
* The STL.

However, why we can use the only language of C:

1) Because it posses better performance and execution speed (real-time programming & etc). A performance difference....
2) Compiler isn't support C++ language, but support C language
(That's something I haven't thought of, but let's say there isn't, in that case, is the lack of C++ compilers for micro controllers means that there can't be, or means that there shouldn't be. Or maybe they didn't design one because it's complex.
3) Probably, it's better to use a tool that is better suited to your task. It's depends...Sometimes the C language can solve your problem more efficiently for certain tasks.
4) A lot of programmers raised on C will stick to C because it's what they know, with logic like "well if you're not going to use the features of C++, you might as well use C". An experienced C programmer has techniques that he's comfortable with and simply doesn't see a need to switch.

Please read following article:
http://wolfhalton.info/2009/09/20/why-do-you-use-c-instead-of-c/
 
Share this answer
 
v2
No, it is not wrong.
C++ is not faster than C, this is true.
Usually code development speed is better using C++ instead of C.
Low level software, in my opinion, should be written in C.
Actually I would use C++ only for big projects (e.g. more than 100000 lines of code).
 
Share this answer
 
v2
All the speed comparisons you tried to discuss are not really correct. It depends on a number of different factors.

"Why only C++?" I have no idea who told you that. As this is just gibberish, how can anyone tell you why? Some people are just idiots, did you know that? :-)

Seriously, even though theoretically speaking, there should not be anything particularly wrong with people who know just one computer language, in practice all people like that are typically extreme loosers or psyco. (I don't mean the beginner, of course; it's natural to start with one.) And this is not because of marker demand or something. People knowing one language often loose the ability to understand computer science, terminology, communicate with qualified colleagues, recognize and solve new problems, etc. I say, this is not the must, it just happens. One factor is: reasonable people would not stay with just one language.

The discussion does not make mush sense though, because knowledge of language and programming are different things. For example, I think that both C and C++ is one of the biggest disasters in the industry and the whole history of computing. I have millions of arguments against them, but of course I cannot proof anything. I avoid using them as much as possible, but… not knowing C and C++ (both of them) — who can afford it? We simply cannot afford not knowing these languages. There are many developers who cannot develop in C and C++ at all, but guess what? There are "real" developers who would not event waste time speaking with such people. Not knowing C and C++ is just ridiculous, no matter if you like it or not.

And finally, you should understand that computer science and the art of programing are positioned well above any concrete languages. If you have knowledge and skills, you can switch to any reasonable language and develop some project, if you really need it. If you cannot work with any language, you know nothing, but if the language is all you know, you still know nothing.

—SA
 
Share this answer
 
v2
Comments
enhzflep 2-Aug-12 16:43pm    
As always, a comprehensive and balanced answer.
Good points on the importance of the mind-set of a programmer over the tool-set.
+5
Sergey Alexandrovich Kryukov 2-Aug-12 16:58pm    
That formulation about the mind-set and the tool-set is yours, not mine, but a good one. :-)
I would prefer avoiding to compare them -- they are not comparable. The other thing is: the tool-sets are created by people with certain mind-sets, not the other way around.
Thank you.
--SA
pasztorpisti 2-Aug-12 17:23pm    
Many ppl in the school don't get knowledge of something very important: how to cogitate... :-) Then how would they use the tools???
BillW33 2-Aug-12 17:00pm    
I agree with enhzflep, a very fine answer. +5
Sergey Alexandrovich Kryukov 2-Aug-12 17:01pm    
Thank you very much,
--SA
If you come from C, then C++ is the next logical step. C is nearly a subset of C++.
And Java and C# cannot be used to low level.

That said, here goes my advice. Try C++. Try other languages (if only to know they exist).
Solve problems in different ways, using different frameworks and languages. Make mistakes. Try to understand the ideas behind languages and frameworks.

My opinion is that when you develop with an open mind, some value go to the program, some value go to the ideas behind the program, but the most value go to the person who programs.
 
Share this answer
 
c & asm must be the best choice,if you want to be a low level/Systems level developer.
c++ are more useful when develpoing some huge things..
 
Share this answer
 
Comments
pasztorpisti 12-Aug-12 11:44am    
C++ can be used to write low level code with much better quality than in C. There isn't a single point in which C is better than C++ especially because C++ contains everything from C, plus it has a lot of fancy features that help you to write less buggy code without sacrificing performance.

EDIT: If you are writing linux kernel modules, then you have to stick to C because of the lack of a good compiler that has only some of the fancy C++ features. But a linux kernel module is not the only thing that contains low level code, lot of user space programs have to deal with that. In Visual C++ its possible to start a C++ project from scratch without fancy runtime library dependencies, and you still have cool C++ features like RAII, and namespaces (and so on...) that improve code quality a lot. Sometimes it worths using C++ even for driver development if code quality is an issue: http://www.mactech.com/articles/develop/issue_04/device_driver.html
ChineseGuy 12-Aug-12 19:56pm    
I learned sth.thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900