Links to articles/data on C vs C++

Started by
18 comments, last by a_question 22 years, 3 months ago
Looks like this would get a better response in Game Programming.

--------------------
Just waiting for the mothership...
--------------------Just waiting for the mothership...
Advertisement
Anyone who has a true grasp on object oriented programing will never want to go back. But then again anyone who has a tryed and proven methodology in C may never want to spring for C++. The truth is that C++ is far superior to C in terms of intuitiveness. And if your a beginning programer thats exactly what you want. Unfortunatly C++ was built on C and thus suffers from a bad "identity crisis" in which there are way too many ways to do anything (which is probably a good thing). Personally I could not deal with programming in C now that I have experianced C++. Also you can program C style in C++ so their is no excuse for using C.

SniperBoB
quote:Original post by Diodor
I like the C header files way more than the ugly C++ header files. If in a C++ header you add tons of private stuff noone needs to know about, in C you just add a function or three.

What, no variables?

That points to one of the perceived "deficiencies" of C - the fact that the data you operate on is dispersed throughout the application and vulnerable to modification from a thousand places (which also makes it harder to trace some bugs).

quote:I like C because there aren''t so many namespaces. Not confusing at all. Everything global and that''s it.

Not anymore, my friend. See C99.

quote:An advantage is that making minor architecture changes is trivial. Try splitting a C++ class that you derive another class from that you derive another class from in two separate structures.

If you need to do that in C++, your design was probably bad in the first place and you should be punished for it. However, it''s very possible:
class A; // original base classclass B : public A; // original derived class.// refactored design:class A1;  // new split implementationclass A2;class A : public virtual A1, public virtual A2;class B : public A; 

Remember, we have multiple inheritance too.

quote:I like the C naming conventions. In C you always know at all times what functions and variables come from what module. Browsing through code is a lot easier. I don''t have to keep track of the class a function belongs too. I also find having different functions names for different param types helpful. All the info I need I can get from reading the code.

I don''t get this. You''re saying we can''t get where a function comes from in C++? Let''s see:
// C:void Draw(Sprite *pSprite);void Draw(Obj3d *pObject);...// C++void Sprite::Draw();void Obj3d::Draw(); 

Not only is the C++ clearer in establishing relationships, it also is easier to use in loops in conjunction with either inheritance (make the function virtual) or RTTI (which C plain doesn''t have). Unless, of course, I totally misunderstood your point (in which case I apologize).

Don''t get me wrong, I love C as much as the next guy. But don''t put C++ down on invalid arguments. Choosing between C and C++ is a preference and a function of impression (what you''re told when you''re starting out). I was told straight up to ditch C and go for C++ (this barely 3 months after starting out), so I hold that view since it worked for me.

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
You sound to me like you are a beginner to programming. If this is so then you should learn to program in the basics of c then c++. Check out etheir this site or
www.geocities.com/gcgameruk
Group Who
Thanks all for your input - this is exactly the type of thing im looking for! :-)

Ive ordered the book as well, MadKeithV. Thanks!

> Anyone who has a true grasp on object oriented programing will never want to go back. But then again anyone who has a tryed and proven methodology in C may never want to spring for C++

This pretty much hits it on the head. Im familiar with C, but am curious about C++. So, im learning C++ - (language is NP, how to think/design in a OOD manner is a bit tougher :-) ), and asking around in various forms to see if people have any info. Book reccomendations are welcomed as well! :-)

every language has it''s purpose. furthermore i would rather be schooled in the fundamentals and theories of programming than grasp to a particular language as if it were my last kidney. if you understand HOW TO program then you will be able to apply your knowledge effectively to whatever language you choose. IMO, c would be appropriate for tight, low-level (i.e. low-level driver, i''m talking kernel level). where c++ is more of an application level language. this is just an opinion, and i''m sure you could argue either way. i personally wrap a lot of ANSI c functions with c++ classes for portability (i.e. my own "File" class that wraps "fopen, fclose, etc").

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
You''re all fools!
The Great Computer Language Shootout

We should all be programming in Ocaml, at least according to these weights.
I highly suggest you go here and download this book, Thinking in C++

http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

He compares the 2 very well at the same time teach c++. Excellent reference.
quote:Original post by Stoffel
You''re all fools!
The Great Computer Language Shootout
I love it!

We should all be programming in Ocaml, at least according to these weights.

But since we aren''t, we at least choose the next best thing (C++)! And ocamlb doesn''t count since it doesn''t compile to native code!

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
" I know you''ve already been directed to another forum, but I''ll jump in and give you an excellent reference on why there is no reason NOT to use C++ in your projects:

Efficient C++ - Performance Programming Techniques. Dov Bulka & David Mayhew, Addison Wesley, ISBN 0-201-37950-3. "

The book came in today, and is _exactly_ what I was looking for.

Thank you very much!

This topic is closed to new replies.

Advertisement