20 ms·
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#
by Pxtl 13y 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.
- pjmlp 13y agoI 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.
- ajanuary 13y agoI 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-stack-is-an-implementation-detail.aspx http://blogs.msdn.com/b/ericlippert/archive/2009/04/27/the-s...
- Pxtl 13y agoRegardless, C# has a linguistic feature that provides objects with stack-like performance and copy-by-value semantics familiar to C developers.
- Guvante 13y agoThere is heavy rumors going around that a new version of C# with a more well defined memory model is in the works.