5 ms·
Normally I'd agree with you, especially when concerned with languages like JavaScript. But C# is a different beast. It's being used quite frequently in large ga
by BinaryIdiot 8y ago
Normally I'd agree with you, especially when concerned with languages like JavaScript. But C# is a different beast. It's being used quite frequently in large gaming projects and even operating systems where it is frequently less managed.You can even use it out of the box in a more, but obviously not entirely, unmanaged way to increase performance.
I don't consider this pedantic in this case. But the line isn't hard so we'll have some disagreement how to teach / not teach this.
- reitzensteinm 8y agoDo you have any examples of projects where it's used in a "less managed" context? Are you just talking about avoiding GC, or something more advanced? Even when you write in a low level style using the .Net/Mono VM, you're still fully protected by the guarantees of the language and runtime. You can't chase bad pointers around through memory or overflow the stack. It's impossible to access an array without a bounds check unless the JIT can prove it's not needed. The safety this provides is night and day to what it's like coding close to the metal (I develop games in C# and have written a fair amount of C/asm). But as you say, we can agree to disagree about that...
- pjmlp 8y ago> You can't chase bad pointers around through memory or overflow the stack. It's impossible to access an array without a bounds check unless the JIT can prove it's not needed. Many native languages have these features without having a managed runtime.
- daeken 8y agoYou can absolutely do everything you described. You can use raw pointers in C#, to the extent that almost any C code can be converted 1:1 to C#. The memory safety goes out the window when pointers are in play; this is why we have 'unsafe' blocks.