Open kjk opened 6 years ago
Dear @kjk
++p
is pointer ariphmetic in C, but in Go we haven't simple access to pointer ariphmetic(we have to use package unsafe
), but it is look ugly.
Thank you for your solution. Feel free for implemented in c2go
.
This example is extracted and simplified from https://github.com/commonmark/cmark/blob/master/src/scanners.c
Is translated to:
++p;
was translated to:p = (*(*[1000000000]uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&p[0])) + (uintptr)(1)*unsafe.Sizeof(p[0]))))[:]
It seems like the right translation should be
p = p[1:]
.