Earlier quoted context omitted.
> that guy asked Stack Overflow how to make gcc compile his .png Do you have a link to this? All the search results I'm getting are related to libpng.
I can't find it with a more specific search on SO, maybe it was deleted. The question was like: I wrote "hello world" but I get some compile errors, followed by an image embed of a handwritten hello world program, followed by a compiler command where the input file had a .png extension and an error related to the compiler not being able to read PNG files, followed by quoting the part of the standard where it says the…
I write games in C (yes, C) (2016)
221–230 of 288 posts
Re: I write games in C (yes, C) (2016)
#222>I really dislike javascript, it is so loose that I marvel that people are able to write big chunks of software in it. I have no interest in trying. Because they use Typescript. >The stop-the-world garbage collection is a big pain for games There is a number of languages that allow manual memory management: Zig, Nim, Rust and few others
Nim not only has support for manual memory management, but there're several gc modes that are not stop-the-world.
Also, since Nim 2, the stdlib now is using ARC by default, which is deterministic and has advantages over conventional garbage collection.
Re: I write games in C (yes, C) (2016)
#223Earlier quoted context omitted.
> then end up reimplementing virtual interfaces manually C++ dynamic dispatch (your "virtual interfaces") is achieved by welding a vtable onto every type and providing a pointer to that vtable for instances of the type. If in 90% of your code you deal with specific types like Goose or Swan or Duck or Seagull, and only 10% needs to work with the broad Bird category well, too bad, every Goose, Swan, Duck and Seagull ca…
> by welding a vtable onto every type It's not true. Virtual methods table is present only for classes with at least one virtual method. Learn C++ properly before doing such claims.
Re: I write games in C (yes, C) (2016)
#224> I like Go a lot. In many ways it is C revisited, taking into account what has be learnt in the long years since it was released. I would like to use it, but there are big roadblocks that prevent me. The stop-the-world garbage collection is a big pain for games, stopping the world is something you can't really afford to do. I'm no Go fan, to be clear, but GC isn't the problem with Go. It has a pretty decent GC with…
The performance gains from bit-level control over memory come from managing the layout to ensure cache locality and do things like SIMD - and nowadays even GPU kernel offload. Enormous performance gains. I agree that it really isn't about garbage collection pauses, but I haven't heard people focusing on "eliminating gc pause" when they talk about low level languages, but they spend a lot of time talking about SIMD, G…
Re: I write games in C (yes, C) (2016)
#225Earlier quoted context omitted.
> then end up reimplementing virtual interfaces manually C++ dynamic dispatch (your "virtual interfaces") is achieved by welding a vtable onto every type and providing a pointer to that vtable for instances of the type. If in 90% of your code you deal with specific types like Goose or Swan or Duck or Seagull, and only 10% needs to work with the broad Bird category well, too bad, every Goose, Swan, Duck and Seagull ca…
Except that C++ provides the tools to do just like C, Rust, or whatever one feels like doing for dispatching, even if it requires a few pages of template metaprogramming mixed with compile time executions, or writing exactly the same C code on the common subset across both languages. Now with reflection even more tools will be available. Which is why despite all its warts and security flaws, many inherited from C sou…
You can write C++ style OOP hierarchy code in Rust but that's not idiomatic, and you can write Rust style explicit dynamic dispatch in C++ but again it isn't idiomatic.
Re: I write games in C (yes, C) (2016)
#226Earlier quoted context omitted.
> because the LLVM people called their frontend "clang" I can't even use that Said frontend is for the C programming language. Isn't that perfectly appropriate? I did a web search for "golang" and the first result was a download page for a Go compiler, so there is precedent.
What's the first result for "clang"? How about in private browsing?
Which is the best one could hope for given that the search engine doesn't control the content. If I am searching for "golang", a Go compiler is the most likely thing I would want to find. Presumably someone who already has a Go compiler installed will have more specific queries. Likewise, if I am searching for "clang", a C compiler is also the most likely thing I would want to find. For all intents and purposes that is the entry point into using a language.
All in all the search engine did a great job and gave exactly what I would have expected.
Re: I write games in C (yes, C) (2016)
#227Earlier quoted context omitted.
Except that C++ provides the tools to do just like C, Rust, or whatever one feels like doing for dispatching, even if it requires a few pages of template metaprogramming mixed with compile time executions, or writing exactly the same C code on the common subset across both languages. Now with reflection even more tools will be available. Which is why despite all its warts and security flaws, many inherited from C sou…
Because these are General Purpose languages you can do the same things, but the contrast here is what's provided in the box and how it is used idiomatically, because in practice that's what gets used, and that's what I explained above. You can write C++ style OOP hierarchy code in Rust but that's not idiomatic, and you can write Rust style explicit dynamic dispatch in C++ but again it isn't idiomatic.
Re: I write games in C (yes, C) (2016)
#228Earlier quoted context omitted.
The question is the performance optimisations on top. 1990's compilers were also super fast, they only did optimisation for size, speed, constant propagation, and little else. Zero code motion, loop unroling, code elision, heap via stack replacement, inlining,...
Of course, but gcc with -O0 is still slower and there is no TCC for C++.
Re: I write games in C (yes, C) (2016)
#229I write mostly like I would in C, but use C++ features as needed. It ends up looking similar to Rust if you squint. All these "I write games in C" people complain about C++ features, and then end up reimplementing virtual interfaces manually with struct headers or massive switch statements, just to feel better about themselves. Writing games in C is not harder, you just have to implement modern language features by h…
> then end up reimplementing virtual interfaces manually C++ dynamic dispatch (your "virtual interfaces") is achieved by welding a vtable onto every type and providing a pointer to that vtable for instances of the type. If in 90% of your code you deal with specific types like Goose or Swan or Duck or Seagull, and only 10% needs to work with the broad Bird category well, too bad, every Goose, Swan, Duck and Seagull ca…
Re: I write games in C (yes, C) (2016)
#230Noble quest, but without operator overloading when dealing with Matrix*Vector you end up with an unreadable mess for physics, skeletal animation etc. There is a reason professional game dev is still 90% C++. (Funny enough, amateur gamedev is C# these days, students use what they learn at uni).
Funny enough, amateur gamedev using C# is a billion USD industry.