News for hackers. Stuff that matters.
Re:Why I Write Games in C (yes, C) by littlestymaar on Saturday September 21, 2019 @04:22PM (#21037702)
You're not using the GC at all then. Why use Go (and praise its GC) in that case?
Re:Why I Write Games in C (yes, C) by Skunkleton on Saturday September 21, 2019 @05:29PM (#21038032)
For the joy of getting the round peg through the square hole of course.
Re:Why I Write Games in C (yes, C) by xyproto on Saturday September 21, 2019 @06:09PM (#21038196)
Go has many advantages over C that are not related to GC.
Re:Why I Write Games in C (yes, C) by littlestymaar on Sunday September 22, 2019 @03:44AM (#21040168)
In a context where you don't allocate memory, you lose a lot of those (for instance, you almost cannot use interfaces, because indirect calls cause parameters to those calls to be judged escaping and unconditionally allocated on the heap).

Go is a good language for web backend and other network services, but it's not a C replacement.

Re:Why I Write Games in C (yes, C) by xyproto on Wednesday September 25, 2019 @05:37AM (#21069158)
If you allocate a large block of memory manually at the start of the program, then trigger the GC manually when it suits you, won't you get the best of both worlds?
Re:Why I Write Games in C (yes, C) by Valmar on Sunday September 22, 2019 @12:40AM (#21039699)
Go also has many disadvantages, compared to plain C.
Re:Why I Write Games in C (yes, C) by xyproto on Sunday September 22, 2019 @03:06AM (#21040066)
Can't think of any. Do you have an example?
Re:Why I Write Games in C (yes, C) by littlestymaar on Sunday September 22, 2019 @03:22AM (#21040101)
You can't call native libraries without going through cgo. So unless you don't want to have audio, draw text and have access to the graphic APIs, you'll need cgo, which is really slow due to Go's runtime. For game dev, that's a no go (pun intended).

Additionally, the Go compiler isn't trying really hard at optimizing your code, which makes it several times slower on a CPU-bound task. That's for a good reason: because for Go's usecase, compile-time is a priority over performances.

Saying that there is no drawbacks in Go is just irrational fandom…

Re:Why I Write Games in C (yes, C) by xyproto on Sunday September 22, 2019 @08:07AM (#21040971)
You are only talking about the Go compiler from Google.

GCC also supports Go (gccgo) and can call native libraries just like from C.

I'm not saying there are no drawbacks in Go, just that I can't think of any advantages of C over Go.

Re:Why I Write Games in C (yes, C) by takeda on Saturday September 21, 2019 @09:08PM (#21038977)
Go was pushed as a C replacement, but very few C programmers switched to it, it seems like it took hearts of some of Python, Ruby, Java etc programmers.
Re:Why I Write Games in C (yes, C) by freyr on Saturday September 21, 2019 @11:49PM (#21039555)
Nonetheless, Go has many advantages over C that are not related to GC.
Re:Why I Write Games in C (yes, C) by takeda on Sunday September 22, 2019 @06:35PM (#21044417)
So does Python or Ruby, that doesn't mean it is a C replacement.