Jump to content
  • Advertisement
Sign in to follow this  
EDBarrera

C/C++ (game programming)

This topic is 2592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I'm a Java developer and I'm learning C, I would like to learn C++ too but after C. I noticed most people use C++ to create games instead of C. I know that C++ has many features such as inheritance, polymorphism... and I know it's an hybrid language, I mean, you can use structured programming or object-oriented programming. I think to use structured programming is faster than use object-oriented programming, at least in Java, so why do people use C++ to create sophisticated games?

Thank you in advance.

Share this post


Link to post
Share on other sites
Advertisement

Hi everyone, I'm a Java developer and I'm learning C, I would like to learn C++ too but after C. I noticed most people use C++ to create games instead of C. I know that C++ has many features such as inheritance, polymorphism... and I know it's an hybrid language, I mean, you can use structured programming or object-oriented programming. I think to use structured programming is faster than use object-oriented programming, at least in Java, so why do people use C++ to create sophisticated games?

Thank you in advance.





To be honest, I really don't understand why you would learn C before C++ unless you have a very specific use in mind. As a Java programmer, C++ would probably be a better fit.


One programming paradigm is not necessarily faster than another, OO isn't inherently slower.


As to why do people use C++:
  • it's whats used already. Traction if you will
  • it's what the vast majority of libraries support
  • it's available on many platforms
  • it's low enough level to be able to be fast, while high enough to be (reasonably) productive
  • there are enough people reasonably fluent in it to provide a large employee base
  • it is unencumbered by corporate ownership
  • it is flexible
  • it's what's used already.

    C++ was created specifically to handle complexity in large systems, where C tended to become a bit of a mess.

Share this post


Link to post
Share on other sites
You should also know that C and C++ are distinctly different languages.

When it started in the early 1980s it was just "C with classes". It was specialized in the early '90s by compiler vendors in ways that were not compatible with C. The divergence was standardized in 1998. For any significant program, properly written C code will have many fundamental errors and many serious compiler warnings when run though a C++ compiler.

They have diverged even further over the years. The C language further diverged with the C99 standard, and will change again with the C1x standard when it is approved. The C++ language diverged again the C++2003 standard, the C++ TR1, and the recently approved C++2011.


While the two languages are related historically, the relationship today is more akin to the relationship between C and C# or C and Java; they influence each other but are not code-compatible.

Share this post


Link to post
Share on other sites
Hidden
Even if you are planing to completely ignore OOP, I would still go with C++. It adds some handy features, beginning with block comments, being able to declare variables anywhere in a function etc.

Share this post


Link to post
OK, thank you all!

Telastyn, because I just know Java I imagined creating objects in C++ were less performant than using data structures because in Java create objects is costly, or to give another example, when you define a class its attributes have to be private and you must access them using member functions (object-oriented programming).

Serapth, I want to learn C before C++ for the following reasons:

* I think C is smaller than C++, I mean, C has less features than C++ to learn, so I could learn this language faster.
* I want to learn a low-level language.
* I want to learn some concepts about raytracing. I implemented some of them such as camera, projection plane... using Java but I know C or C++ is better for all these type of stuff.

Thank you frob for your brief description about how these languages grown up, it was useful to keep in mind that C++ isn't an improve version of C, they are definitely different languages.

Share this post


Link to post
Share on other sites


Telastyn, because I just know Java I imagined creating objects in C++ were less performant than using data structures because in Java create objects is costly, or to give another example, when you define a class its attributes have to be private and you must access them using member functions (object-oriented programming).



This is incorrect, even in Java.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!