Procs
func reinterpretPtr[T: ptr or cstring](src: ptr or pointer): T {.inline.}
-
Reinterpret the given pointer to a different pointer type.
This is same to cast, but only accepts a pointer type for safer type convertion. But it still can be unsafe.
Example:
var x: int = 12345 px: pointer = x.addr doAssert reinterpretPtr[ptr int](px)[] == 12345