I'm trying to convert this c++ to go.
This is in short what the c code is doing:
static const char *pSharedMem = NULL;
int sessionInfoOffset;
return pSharedMem + pHeader->sessionInfoOffset;
This is my (pseudo) go code:
var pSharedMem unsafe.Pointer
sessionInfoLen C.int
byteSlice := C.GoBytes(pSharedMem, pHeader.sessionInfoLen)
return byteSlice[pHeader.sessionInfoOffset:]
I've never really written any C code and I have no idea if this a good way of retrieving a byte slice from an unsafe.Pointer. Could go anything wrong with this (copying wrong piece of memory or something) and is this performant of am I doing something really stupid?