.net - System.IO.UnmanagedMemoryStream - why Byte* instead of IntPtr -
anybody have idea why bcl team chose use byte* instead of intptr in constructors unmanagedmemorystream? forces using unsafe context in order construct type. seems have used intptr , wouldn't have forced unsafe context.
i'd guess because safer. if have used intptr, constructor called garbage value. byte* there's @ least shot @ compiler verifying memory valid , pinned. albeit casting intptr byte* pretty simple.
Comments
Post a Comment