Archived

This topic is now archived and is closed to further replies.

superdood13

C or C++? Preferrence or does it matter?

Recommended Posts

superdood13    122
Is there much of a necessity for OOP in games? I''m new to game programming and as I am reading most of the books that I have, most of the authors prefer to use C instead of C++. I know that windows is object oriented so I should be familiar with C++ for Windows programming but for the actual game code is it actually better to use plain C? or does that even make much of a difference? -Josh

Share this post


Link to post
Share on other sites
Fruny    1658
This is a religious issue.

C++ can have a hefty overhead if you aren''t careful.
C can lead to unreadable code if you aren''t careful.

Windows isn''t really object oriented, its API is pure C, though MFC is a C++ framework.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
there is a lot more to C++ than OOP, it is just one of its many features. Even if you want to program in C you can use C++ to make it prettier, member functions instead of global functions for example, new instead of malloc.

Share this post


Link to post
Share on other sites
Oluseyi    2116
Fruny summed it up perfectly: it is a religious issue.

Now, for the AP: the only significant difference between C and C++ that is meaningful is stricter type-checking. I think that has been/is being addressed by C99. Beautification and the rest are just details: public member functions are as global as "global functions", and private "global functions" can be created by using the static keyword. In fact, though I''m a convicted C++ programmer, I sometimes prefer to use file-scoping rather than a class.

Go figure.

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites
Fruny    1658
quote:
Original post by Oluseyi
though I''m a convicted C++ programmer



With several (reference) counts of OOP on his record (it''s public, hence a struct), he won''t be returned to the free store for the next 30 years.

Share this post


Link to post
Share on other sites
Oluseyi    2116
quote:
Original post by Fruny
With several (reference) counts of OOP on his record (it''s public, hence a struct), he won''t be returned to the free store for the next 30 years.


roofle! :D

I especially like the reference to the free store; its like allocated memory that wont be released for a good while. Nice one.

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites