The 2024 Wheel Reinvention Jam just concluded. See the results.

C vs. C++ vs. C# (Beginner)

ratchetfreak
The extra compile time when going from C to minimalist C++ is negligible.

C++ compile times start to explode once you have very large and template heavy headers being included. Which in turn affects link time when a lot of duplicate symbols from inline functions and template instantiations need to be pruned.


When compiling the identical code in G++ instead of GCC, the compile time is a second longer. No seconds are negligible for my workflow.
So for what I’ve seen is that Minimalist C++ @ HN is operator and function overloading. What else? Is there a complete list?
Telash
ratchetfreak
The extra compile time when going from C to minimalist C++ is negligible.

C++ compile times start to explode once you have very large and template heavy headers being included. Which in turn affects link time when a lot of duplicate symbols from inline functions and template instantiations need to be pruned.


When compiling the identical code in G++ instead of GCC, the compile time is a second longer. No seconds are negligible for my workflow.


On the other hand, compile time is probably less of a concern when you are in the process of learning, and essentially building small to medium sized projects / exercises, as opposed to working on a large codebase.

I would say pick C because it's easy to learn and has all the basics that you need to understand in the first place, yet it doesn't try to hide how the machine is working. Using some features of C++ like operator overloading is really a matter of taste and convenience at that point.

Also, knowing a bit of C++ is handy to read other people's code. Just don't spend too much time on trying to master all the details of templates or object-oriented polymorphism : it will make you feel smart, for sure, but that's not the goal of learning :-)

If you do end up going with C I suggest trying to grab a copy of Programming C: A Modern Approach fantastic book although expensive. Also, I recently compiled a list of project based tutorials in C on Github that might be helpful.
rby90
If you do end up going with C I suggest trying to grab a copy of Programming C: A Modern Approach fantastic book although expensive. Also, I recently compiled a list of project based tutorials in C on Github that might be helpful.


Thank you so much for these resources, they are amazing! And thanks to everyone for taking the time to share your insight and expertise, it is much appreciated.

So far my book list is:

Computer Graphics: Principles and Practice in C (2nd Edition)
Foundations of Game Engine Development, Volume 1: Mathematics
Real-Time Rendering, Third Edition
Real-Time Collision Detection

I have also added the book recommended above.

As for what portion of C++ I am going to use, I've decided that I need to gain much more experience with C before I should consider utilizing any C++ features, as my reasoning for why I should utilize them would simply be derived from a lack of knowledge. Until then, I will stick with C.
Kamelitø
So for what I’ve seen is that Minimalist C++ @ HN is operator and function overloading. What else? Is there a complete list?


I think it varies for each developer, and so I think it'd be valueless to define precisely. The way I see it, "minimalist C++" is writing software that is compiled from C++, doesn't make much use of most modern C++ language features, and does this usually to follow with the handmade spirit fundamentally. There are certain patterns that this way of software development tends to conform to, but not necessarily (object-oriented programming is not nearly as common in the set of developers who follow this way of software development, for example, because many modern C++ features were designed to facilitate object-oriented programming).

Hesitating to define what this term means precisely does not necessarily mean defining it in a less precise fashion tells us nothing. There is the gray area that is somewhere in the middle between "minimalist C++" and "non-minimalist C++", but what is most important is that we recognize the difference in nature between a shift toward minimalist C++ versus that away from minimalist C++.

This is also far less important, in my opinion, than the difference between "handmade" and "non-handmade".
Kamelitø
So for what I’ve seen is that Minimalist C++ @ HN is operator and function overloading. What else? Is there a complete list?


Delix
...
This is also far less important, in my opinion, than the difference between "handmade" and "non-handmade".


Since I threw that term out there, I can explain what I specifically meant. I was specifically trying to emphasize using languages where most of your time investment goes into transferable skills. The more quirky the language is, the more time you will invest into understanding those quirks, which are not transferable skills. "Full" C++ is without a question too quirky, and C is maybe missing useful features. So for me "minimal" C++ is the set of features that don't increase how much I think about the language. Which features those are is probably personally different from person to person, but as Delix suggested, I too think that people who try to answer that question with a "handmade" attitude tend to come up with similar looking results.

Edited by Allen Webster on Reason: grammar
Mr4thDimention
I was specifically trying to emphasize using languages where most of your time investment goes into transferable skills. The more quirky the language is, the more time will be invested into just understanding the quirks of that language, which are not transferable.


You nailed it. I wish more people were talking about this.
Doe it means using C++98/03 and not modern C++11/14/17?
Is OOP part of minimalist C++?
Is it like Orthdox C++?
https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b
I can speak to those last 3 books as being good reads. If you want a more general, very wide view of game programming topics, I'd suggest Jason Gregory's Game Engine Architecture 2nd Edition. For $50, I think it strikes a pretty good balance between pointing out lots of concerns while also diving in where space permits.

FWIW, learning C# is extremely worth it. If your goal is to get a game programming job sometime in the future, baaaasically every current entry-level position I see prefers some amount of C# knowledge. A lot of companies use it on their tools side.
Another resource is game programming patterns . You can view the whole book on the site. I found the Bytecode chapter a good read.
I bet 10 people will disagree with what I'm about to say, but this is my opinion gathered from years of experience in the industry:

C was invented in the late 60s and early 1970s. C is used primarily in these days for low-level driver-level kind of stuff and embedded. There are a lot of legacy projects in C. C is cumbersome and requires a lot of effort to do very little, but it's efficient (or, rather, as efficient as the programmer makes it.) It's also available on a wide array of platforms from embedded MCUs to CPUs and the like.

C++ is also used for embedded (it has a flavor called literally "Embedded C++" and is also used by Arduino / Processing IDE for Marlin) ... But, C++ is also good for higher level stuff. By Bjarne's own words he claims C++ is a language for both the driver low-level and the application high-level, all in the same project. However, C++ is an old language and suffers from its evolution as much as anything that is > 30 years old. (the spec is over 1600 pages)

C++ also involves learning STL and/or Boost. This is similar to the way a Java developer learns the Java Library.

C# on the other hand is a fairly new approach and is a Microsoft language. It's used by newer tools (Unity, Xamarin, Windows Universal App Platform) and it is considered a truly dynamic language (whatever that means) .. it's an application-level language. It does a lot more under the hood that the previously mentioned.

But, you can write games in other languages like Java, Processing and Javascript (nodejs or otherwise). In fact I'm in the process of getting a new project approved here at Handmade around writing cross-platform "native compiled" nodejs using Electronjs. See: http://github.com/LAGameStudio/pixitron

There are also homegrown IDEs like Ecere http://ecere.org

Edited by Lost Astronaut Studios on