Why do people prefer C to C++??
This confuses me a lot. I am a beginner to C++ and all books I read say that C++ is better than C because it is basically C and more and is specially designed for objected oriented programming. So why do I hear people talking badly about it (I don''t mean here on this message board! but other places) If C++ is an upgrade then why do people still perfer the first version ??
This really confuses me becuase I love c++ becuase I find it much better then C in the fact of OOP programming.
Someone tell me why??
---------------------------------------------You Only Live Once - Don't be afriad to take chances.
I am going to end this thread before it has a billion posts. C has traditionally been used instead of C++ because the compilers for C++ couldn't compile games with enough performance. Since games usually test a machines capabilities, performance is paramount. The trend that exists today is to use C++ because those performance difference are fading fast.
The only other point is that while C++ is a good object oriented language, object orientation in and of itself has inherent performance considerations.(ie RTTI, virtual functions, inheritance...) As processors get faster and memory increases, the latent performance considerations of C++ tend to not mean as much to the overall program performance. In this regard the increase in productivity gained by using C++ is more valuable than the performance gain in not using it.
Hope that helps.
Kressilac
ps This is a nasty religious war, I hope I was able to do both sides justice.
Edited by - kressilac on 2/4/00 10:57:29 AM
The only other point is that while C++ is a good object oriented language, object orientation in and of itself has inherent performance considerations.(ie RTTI, virtual functions, inheritance...) As processors get faster and memory increases, the latent performance considerations of C++ tend to not mean as much to the overall program performance. In this regard the increase in productivity gained by using C++ is more valuable than the performance gain in not using it.
Hope that helps.
Kressilac
ps This is a nasty religious war, I hope I was able to do both sides justice.
Edited by - kressilac on 2/4/00 10:57:29 AM
Derek Licciardi (Kressilac)Elysian Productions Inc.
I''ve never understood the frenzy that this discussion causes. Use whatever you want to use and that''s it. I personally prefer C++ because it''s easier to think in terms of objects and, if done well, makes your code easier to read when you have to come back to it a year later . As kressilac said, there''s virtually no performance hit with the current compilers and as technology advances this will be even more of a non-issue.
Breakaway Games
Breakaway Games
Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development
One advantage that C has over C++ is that it''s easier to get an idea what the emitted code looks like. If you think in terms of code rather than objects thats a big advantage.
Another advantage C has over C++ is that it''s (on the whole) easier to work with code generated by C in other languages that it is with C++.
Another advantage C has over C++ is that it''s (on the whole) easier to work with code generated by C in other languages that it is with C++.
Some people are of the opinion that C++ is more convoluted than C, and that C is more WYSIWYG (what you see is what you get). However, the obfuscated C code contests disprove this assertion.
C is a much "cleaner" language than C++ has become.
When C++ was simply "C with classes", it was pretty cool, even handy. But then they let everyone and their rabid dog submit extensions to the "C++ Standard" and now you have a mess.
Any language can be "obfuscated", but few can do it like C++. You want obfuscation, I give you operator overloading and implicit constructor calls. You want totally unclear, I give you default parameters and function overloading. You want code bloat, I give you inline functions and templates.
All of these seemed like really cool features when I first encountered them back in 89-90. But now I see them for what they are: Programmer-oriented shortcuts that save on typing but render a section of C++ code almost undecipherable. You take a block of "standard" C code, and you can see exactly what it does. You take a block of "standard" C++ code and you literally have no basis for *any* conclusions about what it''s doing unless you have full access to the source of all classes and functions reference. And even then it''s iffy.
I was a data-centric programmer before "object oriented" was a buzzword, so don''t go off on me about being an illiterate oaf with no experience in the "real world" of programming and design.
I agree Machaira: Use what you want to use. You know what you''re most productive using. If you can create an FPS with Excel spreadsheet macros, go for it.
DavidRM
Samu Games
When C++ was simply "C with classes", it was pretty cool, even handy. But then they let everyone and their rabid dog submit extensions to the "C++ Standard" and now you have a mess.
Any language can be "obfuscated", but few can do it like C++. You want obfuscation, I give you operator overloading and implicit constructor calls. You want totally unclear, I give you default parameters and function overloading. You want code bloat, I give you inline functions and templates.
All of these seemed like really cool features when I first encountered them back in 89-90. But now I see them for what they are: Programmer-oriented shortcuts that save on typing but render a section of C++ code almost undecipherable. You take a block of "standard" C code, and you can see exactly what it does. You take a block of "standard" C++ code and you literally have no basis for *any* conclusions about what it''s doing unless you have full access to the source of all classes and functions reference. And even then it''s iffy.
I was a data-centric programmer before "object oriented" was a buzzword, so don''t go off on me about being an illiterate oaf with no experience in the "real world" of programming and design.
I agree Machaira: Use what you want to use. You know what you''re most productive using. If you can create an FPS with Excel spreadsheet macros, go for it.
DavidRM
Samu Games
Another point that wasn''t mentioned in detail yet is the increased size of the overhead that Class and the member functions. If you have time-critical code it is vital that it is executed as fast as possible.
That''s why Quake for example uses C instead of C++
- Sleepwalker
That''s why Quake for example uses C instead of C++
- Sleepwalker
- Sleepwalker
The reason why that point wasn''t mentioned is because it isn''t true with modern compilers. Only virtual member functions really have overhead now.
I''m a bit of a hybrid in this area, because I like to use mainly C with some C++.
The complete OO paradigm is not for me, but I can see why people like it - maybe I''ll change to it eventually. What I do like is to have the odd class for wrapping, e.g. vector and matrix math.
I disagree with DavidRM when he talks about code-bloat with inline functions, the principle of such functions (to me anyway) is to keep them short, and in essance replace the #define macro''s we all used to use. When you get an inline function that performs the inverse of a 3x3 matrix, then you get silly code bloat.
Anyway thats all.
I might prefer one to the other - but they both have merits,
and you can use whatever you like, it''s up to you in the end. I''ve never seen anyone get a beating because they used C++ instead of C.
Take it easy,
-Mezz
p.s. do you reckon these postings are just to try and start wars?
The complete OO paradigm is not for me, but I can see why people like it - maybe I''ll change to it eventually. What I do like is to have the odd class for wrapping, e.g. vector and matrix math.
I disagree with DavidRM when he talks about code-bloat with inline functions, the principle of such functions (to me anyway) is to keep them short, and in essance replace the #define macro''s we all used to use. When you get an inline function that performs the inverse of a 3x3 matrix, then you get silly code bloat.
Anyway thats all.
I might prefer one to the other - but they both have merits,
and you can use whatever you like, it''s up to you in the end. I''ve never seen anyone get a beating because they used C++ instead of C.
Take it easy,
-Mezz
p.s. do you reckon these postings are just to try and start wars?
Well, regardless of what language you use, im impressed that this message board handled the question in an adult manner. I read some message boards that this would have turned into a complete flame war. Thank goodness that no one brought up VB or we may not have been able to hold back the flames....hehe.
Mike BarelaMikeB@yaya.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement