Closed tersec closed 2 years ago
Conceptually, this is attempting to get the base address of the openArray.
openArray
I checked that it so far seemed to always return the same results, where applicable, as the unsafeAddr mem[0] approach, and
unsafeAddr mem[0]
proc baseAddr*[T](x: openArray[T]): pointer = cast[pointer](x)
from nim-stew, while using pointer rather than ptr byte, suggests that this should work as well.
nim-stew
pointer
ptr byte
It compiles to
head = ((NU8*) (mem));
which is correct, as well.
Conceptually, this is attempting to get the base address of the
openArray
.I checked that it so far seemed to always return the same results, where applicable, as the
unsafeAddr mem[0]
approach, andfrom
nim-stew
, while usingpointer
rather thanptr byte
, suggests that this should work as well.It compiles to
which is correct, as well.