Creating a pointer/slice to a specific-size buffer? (Handing out a page/frame from a memory manager)

Ali Çehreli acehreli at yahoo.com
Fri Jan 13 16:31:17 UTC 2023


On 1/13/23 07:07, Gavin Ray wrote:

 > This is "valid" D I hope?

Yes because static arrays are just elements side-by-side in memory. You 
can cast any piece of memory to a static array provided the length and 
alignment are correct.

However, such a cast is not allowed in @safe code.

Ali



More information about the Digitalmars-d-learn mailing list