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迷人的東西中放了很多想法:) –