News for hackers. Stuff that matters.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by kevingadd on Monday December 11, 2023 @03:02PM (#38604765)
It's been pretty straightforward to do this since the start, since C# has had structs and pointers the whole time. It's gotten a lot easier now that there are safe bounds-checked pointer abstractions (Span and Memory) so that you can work with raw memory anywhere you want without constantly having to manually do safety checks to avoid heap corruption. 'where T : unmanaged' means you can finally write generics around pointers too.

now that you can return refs instead of just passing them around, that's also really nice for cases where you want to pass around an interior pointer into some sort of data structure - you can use refs whether a value is allocated via the GC or malloc or stackalloc.

There are no comments on this comment yet.