0
在C/C++我可以投int
到int*
这样将int投射到指针?
int i = 0x1040c108;
int *p = (int*)i; // compiles
,但我为什么能做到这一点围棋不是?
addr := 0x1040c108
p := (*int)(addr) // Error: cannot convert addr (type int) to type *int
在golang中实现这一点的方法是什么?
考虑一下这个包是做我有点惊讶,这个代码是允许类似的golang操场 –
@JasonSperske呀,不开玩笑。他们必须相当信任他们的沙盒。 – RayfenWindspear
显然他们已经在这个https://blog.golang.org/playground迷人的东西中放了很多想法:) –