Advertisement

How many of you use C for game programming?

Started by January 24, 2011 04:33 AM
107 comments, last by Washu 13 years, 6 months ago
I'm very curious. I use it myself because of its simplicity and less haggling with accessor functions, member access, etc. Though many may not agree with me. I'm just curious about what people's take on this is.

Codeloader - Free games, stories, and articles!
If you stare at a computer for 5 minutes you might be a nerdneck!
https://www.codeloader.dev


I use it myself because of its simplicity and less haggling with accessor functions, member access, etc.
If that's your problem with C++ (or OOP?), then you're using C++ wrong.

I voted sometimes -- I mostly only use C for gluing different systems/modules/languages together.
Advertisement
You're missing an option "Hell no!"
Seriously, after working with std::string and the other STL containers it's hair raising annoying having to resort to C instead of C++. I sometimes have to at my work place and I'm glad if I can keep the C parts short.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

I occasionally dip into standard/ANSI C, but only rarely. I much prefer C++ for things like RAII because as Endurion mentioned it really helps avoid certain classes of nasty problems.

Which is not to say I have any love whatsoever for C++.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Only in C. Because I only know C. And I like it, I like "immediate mode" style, and that I can tinker the shit out of it.
But I'm not by any means a programmer.
I tend to stick to higher level languages so C++ is rather nice especially when using boost. I don't tend to use inheritance in languages so I can see where C looks nice. The main problems I have with working in it for extended periods is string functions and lack of standard containers. I'd need to a really valid reason to choose C or C++. I can do anything in C++ in C so there's no real advantage for choosing C. Oh and one of my big gripes is malloc and free are annoying as hell to use with all their casting clutter.
Advertisement
Got forced to for a month or so once - found lack of destructors for RAII the most annoying part. In some ways, I tended not to be as guilty of over-engineering when using C, but equally projects were far more brittle and buggy.
I use C for some of my game programming. Mostly this is because it's one of the languages I'm strongest with, it works well if I plan the architecture in advance and I'm better at debugging C than some other languages. Libraries are easier to use too. Downside is the lack of namespaces and the need to find libraries to do basic things like working with strings (although if I'm doing a lot of string work I'd use another language like Python).
I sometimes use it for small development tools, for instance a small command application that converts one binary format into another, but that's it.

I'm very curious. I use it myself because of its simplicity and less haggling with accessor functions, member access, etc. Though many may not agree with me. I'm just curious about what people's take on this is.



I have this crazy idea sometimes that I want to program in C so at one point I rewrote my latest project to C. I may go back at some point but I am thinking that if I need a high level language I would embed Lua instead of using C++.

I was thinking about what you say about accessor functions. You don't have to use them in C++ and you can, and sometimes should, have them when programming C. But it was quite a relief to get away from idiomatic C++ and just solve the problem. But this limitation is just our heads.

I also think C is quite fun. It is nice to find different solutions to the problems. But having to write container classes is a mess. It takes a few iterations to get them right. I know I am talking against my last paragraph where say "just solve the problem" because I would get some stuff done faster if I would stick to C++ and code with an open mind.

Also C code compiles a lot faster than C++. I think 2 or 3 times faster!

This topic is closed to new replies.

Advertisement