News for hackers. Stuff that matters.
Re:I write games in C (yes, C) by randomtoast on Saturday February 07, 2026 @03:46PM (#46927795)
I’ve seen this play out a lot. People say they “write games in C” and then quietly rebuild half of C++ anyway with vtables in structs or giant switch statements, just without the compiler helping. That’s fine if it makes you happier, but it’s not obviously simpler or safer. Also, C++ compile times are mostly a self-inflicted wound via templates and metaprogramming, not some inherent tax you pay for having virtual functions.
Re:I write games in C (yes, C) by mjburgess on Saturday February 07, 2026 @03:57PM (#46927932)
A switch statement is how you do ad-hoc polymorphism in C -- i dont thinks an own against C developers to point that out. If they wanted to adopt the C++ style that immediately requires the entire machinery of OOP, which is an incredibly heavy price to avoid a few switch statements in the tiny number of places ad-hoc poly is actually needed
Re:I write games in C (yes, C) by whizzter on Saturday February 07, 2026 @04:11PM (#46928083)
You don't usually do C++ subsets if you want the full shebang.

I have a "mini-std" headerfile that's about 500 LoC implementing lightweight variants of std::vector, std::function, a stack-local std::function (unsafe as hell and useful as hell to avoid allocations), a shared-ptr, qsort and some other nifty stuff.

That does a lot of things, but even then I use other patterns that brings a lot of bang for the buck without having to go full C (hint: the stack-local function equivalent gets a lot of mileage).

Re:I write games in C (yes, C) by sandpaper26 on Saturday February 07, 2026 @03:57PM (#46927925)
This reads like an LLM generated response that simply restates the comment it's replying to
Re:I write games in C (yes, C) by randomtoast on Saturday February 07, 2026 @04:06PM (#46928022)
Heck the LLM accusations get a bit out of hand lately here on HN. I could delve into it now ... but I want to safe our time.
Re:I write games in C (yes, C) by direwolf20 on Saturday February 07, 2026 @03:55PM (#46927907)
It's important that you do these things yourself before you utilise the compiler to do them for you, so you have real understanding.
Re:I write games in C (yes, C) by gf000 on Saturday February 07, 2026 @03:58PM (#46927941)
> but it’s not obviously simpler or safer

On top of likely having worse performance.

Re:I write games in C (yes, C) by uecker on Saturday February 07, 2026 @04:57PM (#46928534)
I think it is simpler and "the compiler not helping" == "things are more transparent".

  int a = 3;
  foo(a);
  // What value has a ?

There are various things one does not have to worry about when using C instead of C++. But the brain needs some time to get used to it.
Re:I write games in C (yes, C) by wasmperson on Saturday February 07, 2026 @05:40PM (#46928957)
I think I get what you're trying to say, but you may have picked a bad example, here:

  #define foo(a) a = 12
Re:I write games in C (yes, C) by uecker on Saturday February 07, 2026 @05:49PM (#46929056)
Yes, but this is more a theoretical problems while references are common in C++.