1. 8

  2. 1

    I’m on the verge of jumping into Golang. Damn, I haven’t dealt with pointers, references, and bitmasks in a while… Any one know of a tutorial that explains how Golang handles them?

    1. 2

      Go’s pointers work similarly to C, except that there’s no pointer arithmetic to trip you up. C’s invalid pointer and memory corruption bugs can’t happen in Go because there’s no way of pointing at the wrong things by mistake. Semantically Go pointers are similar to Java’s implicit object pointers except they’re explicit and you don’t have Java’s messy boxing/unboxing problems when dealing with basic types.

      There are no references to worry about. Bitmasks don’t have any special status in the language but you can do bitwise operations like C, Java etc.. If there’s one way of describing Go it would be “straightforward”. It trips you up less with complexity and unpleasant surprises than most languages, while still providing you with the power to do what you need to do.

    2. 1

      honestly, i don’t know why this is advertised as some kind of magical thing.

      dlang has a similar support for enums. http://pastie.org/9530436