News for hackers. Stuff that matters.
Re:Why I Write Games in C by crafn on Saturday January 09, 2016 @11:05AM (#10871689)
When you drop the semantic silliness of C++, like having the container to take care of constructing, copying, moving, and destructing, not to mention exception safety, a basic implementation of a "templated" dynamic array implementation in C comes down to like 100 lines. Hash map will be a bit more, and is not so trivial to write.

It's true that there should be no need to write these things yourself. The alternative C++ gives is not really tempting. A language designed for demanding game development doesn't exist (yet), so one evaluates which is the least worse option.

Re:Why I Write Games in C by hellofunk on Saturday January 09, 2016 @11:09AM (#10871703)
Considering that vector, map, etc are widely used and expected features of software development, I would think that good libraries in C exist for these already, so you don't have to even write your own 100 lines. Are there any?
Re:Why I Write Games in C by lobster_johnson on Saturday January 09, 2016 @04:10PM (#10872900)
GLib (not to be confused with glibc) from the GNOME project has a wide range of functionality -- generic lists, hash tables, strings etc.: https://en.m.wikipedia.org/wiki/GLib

Qt, I believe, also comes with a bunch of "standard library" stuff unrelated to UIs.

Re:Why I Write Games in C by unscaled on Saturday January 09, 2016 @11:17PM (#10874124)
Yes, GLib basically implements its own full-fledged OOP system on top of C. At which point, you start asking yourself, why are you not using C++?

In my experience, most of the people who say they don't need OOP or generics end up implementing a limited (or even a full-fledged) version of these things themselves.

Re:Why I Write Games in C by hellofunk on Saturday January 09, 2016 @04:51PM (#10873024)
But Qt is all c++, no?
Re:Why I Write Games in C by ArkyBeagle on Saturday January 09, 2016 @04:37PM (#10872979)
Hashmaps to the side ( that's more challenging in 'C' and one really compelling feature of C++ ) the rest can frequently be "faked" with arrays. Obviously, scale matters - having fifteen "vector" implementations in a given system means a little bit of library-ness is in order.

Much also depend on how much you really need dynamic allocation - it can be optional.

Re:Why I Write Games in C by typedef_struct on Saturday January 09, 2016 @11:54AM (#10871886)
Re:Why I Write Games in C by a3n on Saturday January 09, 2016 @02:59PM (#10872621)
This is one of the reasons why every time I get nostalgic about C I then immediately get depressed. Having to find the next level of functionality, libraries, all over the internet, just makes my brain turn to peanut butter.

I think this is one of the biggest disadvantage of a mostly standards based, no particular organization in charge type of language like C, as opposed to, say, python.

I am fortunate that, at the moment, my needs are mostly casual and very rarely performance focused. If I needed C I would just STFU and use C, accumulating my own workarounds for the dispersed nature of its resources.

Re:Why I Write Games in C by hellofunk on Sunday January 10, 2016 @06:32AM (#10874994)
I'm curious what you mean when you say "not to mention exception safety" ... What is the general argument against exceptions in C++?