Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 superdood13   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 December 2001 - 08:18 AM

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

Sponsor:

#2 Fruny   Moderators   -  Reputation: 1653

Like
Likes
Like

Posted 12 December 2001 - 08:28 AM

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.



#3 BASSOFeeSH   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 December 2001 - 08:31 AM

Since you put a winking smilie, I take it that was a joke.

^^^^^^^^^^^^^^^^^^^^^^^^^
Wait, wait, wait....who''s Nambla Fett?

#4 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 12 December 2001 - 10:10 AM

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.

#5 Oluseyi   Staff Emeritus   -  Reputation: 1670

Like
Likes
Like

Posted 12 December 2001 - 02:19 PM

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!


#6 Fruny   Moderators   -  Reputation: 1653

Like
Likes
Like

Posted 12 December 2001 - 02:30 PM

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.

#7 Oluseyi   Staff Emeritus   -  Reputation: 1670

Like
Likes
Like

Posted 12 December 2001 - 04:55 PM

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!





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS