3 ms·
Are they finally marking all those functions that use IntPtrs as unsafe? (such as Marshal.Copy)
by Dwedit 5mo ago
Are they finally marking all those functions that use IntPtrs as unsafe? (such as Marshal.Copy)
- orphea 5mo agoNot really, because IntPtr is just a native-sized integer. Marshal.Copy will certainly be marked unsafe, as will anything else that touches unmanaged memory.
- WorldMaker 5mo agoThis change suggests that passing pointers is "generally safe", the unsafe boundaries are when they are de-referenced. It sounds like the Marshal methods are probably going to get a lot of surprising new safety warnings, but not all of them just because of the use of IntPtr. This change does open more opportunities to switch IntPtr to more explicit type-safe options like void* or byte* as the new compiler no longer needs unsafe {} blocks around just passing around pointers from one function to another.