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

Started by
5 comments, last by superdood13 22 years, 4 months ago
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
If the world didn't suck we would all fly off!
Advertisement
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.

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Since you put a winking smilie, I take it that was a joke.

^^^^^^^^^^^^^^^^^^^^^^^^^
Wait, wait, wait....who''s Nambla Fett?
-- What would Sweetness do?
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.
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!
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.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
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!

This topic is closed to new replies.

Advertisement