Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Understand unsafe in GoLang

Before going to understand unsafe package in GoLang, the first thing needs to talk about is the pointer in GoLang. If you have a background of C language, you must know what pointer means and its usage. With pointer, you are free to operate any data at memory level which means you have great power, but this means that you have great responsibility as well. That's why it might be considered unsafe in lots of cases.Take a look at a simple example of doubling an integer.package mainimport "fmt"func double(x int) { x += x}func main() { var a = 3 double(a) fmt.Println(a) // 3}The above ...

17,497 0       GOLANG UNSAFE ZERO-COPY