Recommended Posts

Can anyone provide me with some links to articles/raw data/info on C vs C++. ie speed, code, benefits, etc.
I already read the info in the "What Language" artticle in the articles section of this site.
Posting this here as it seems to be in the "Game Design" area - if not, my aplogies - and feel free to direct me to where you think it should have been posted :-)
Thanks,
Edited by - a_question on January 11, 2002 6:45:31 PM

Share this post

Link to post

Share on other sites

No offence, but if you were a team leader with experience developing several C based projects, and a proposal was made to you saying "Lets switch to C++ for our next project", and when you asked why you got the response "Does it really make a difference", how much stock would you put in that proposal?

> If I had to chose I''d pick Win32ASM

Id hazard a guess that this would be rather difficult to implement on playstation/gamecube/etc platforms.

Anyway, I''m just looking for a comparison/benefits/insight anyone has on using functional vs object oriented design methodologies as they pertain to game development.

Share this post

Link to post

Share on other sites

Sure - I see it as a game design question, but not within the context of what this fourm is used for. Ill take your advice and move it to the game programming fourm; it makes more sense there. And sorry if my last post came off as a partial flame - it wasent meant ot be, but re-reading it im sure it could be conscrued that way :-) I just dont think its a silly question, thats all :-)

That''s an unbiased, straightforward explanation of many of the performance caveats of C++ and Object Oriented Programming in C++, along with excellent explanations of how to avoid them to make your code equally fast as something written in pure C, but more readable.

People might not remember what you said, or what you did, but they will always remember how you made them feel.

Share this post

Link to post

Share on other sites

I agree that performance isn''t an issue with C++, if you know what you''re doing at least. And, if you reach the point where the performance gained by the language counts, you prolly know what you''re doing.

But I like C more than C++ because it''s cleaner, more honest and plain powerfull without losing simplicity.

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.

I like C because there aren''t so many namespaces. Not confusing at all. Everything global and that''s it. 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.

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.

Share this post

Link to post

Share on other sites

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

0

Share this post

Link to post

Share on other sites

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:

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:

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.

Share this post

Link to post

Share on other sites

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! :-)

0

Share this post

Link to post

Share on other sites

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.