Hacker News new | ask | show | jobs
by Pxtl 4445 days ago
C# has support for stack-allocated "struct" objects that avoid the GC. They have their limitations and gotchas, being somewhere between simple C structs and C# classes, but they exist.

GC-based languages run games on many, many platforms. The problem, imho, is that you have to leave 90% of the language features on the shelf when you're doing your main loops in order to avoid triggering the GC.

The gaming industry is practically begging for a language like Rust.

3 comments

I am also looking forward to the .NET Native C# compiler release.

Mostly as a way for young generations to finally grasp GC/memory safe != VM, as they seem to have been brainwashed since Java became widespread.

I feel like I should point out that the stack is an implementation detail [1]

Though in this context it's relevant to point out pretty much any implementation will stack allocate them, it's not accurate to say C# has stack allocated objects.

[1] http://blogs.msdn.com/b/ericlippert/archive/2009/04/27/the-s...

Regardless, C# has a linguistic feature that provides objects with stack-like performance and copy-by-value semantics familiar to C developers.
There is heavy rumors going around that a new version of C# with a more well defined memory model is in the works.