About 427,000 results
Open links in new tab
  1. What's the point of having pointers in Go? - Stack Overflow

    Jan 20, 2015 · Pointers are usefull for several reasons. Pointers allow control over memory layout (affects efficiency of CPU cache). In Go we can define a structure where all the members are …

  2. go - Difference using pointer in struct fields - Stack Overflow

    Jan 29, 2020 · As always: if you're using pointers, you're essentially allowing code to manipulate the memory something points to directly. Given how golang is a language that is known to …

  3. Pointers vs. values in parameters and return values

    May 8, 2014 · 617 tl;dr: Methods using receiver pointers are common; the rule of thumb for receivers is, "If in doubt, use a pointer." Slices, maps, channels, strings, function values, and …

  4. Can we have function pointers in Go? - Stack Overflow

    Aug 30, 2010 · 36 Go doesn't have the same syntax for function pointers as C and C++ do. There's a pretty good explanation for that on the Go blog. Understandably the Go authors …

  5. How to preallocate and fill a slice of pointers in a go-idiomatic way?

    How to preallocate and fill a slice of pointers in a go-idiomatic way? Asked 12 years, 5 months ago Modified 2 years, 2 months ago Viewed 49k times

  6. Comparing pointers in Go - Stack Overflow

    Dec 15, 2015 · I am reading in my Go book that pointers are comparable. It says: two pointers are equal if and only if they Point to the same variable or both are nil. So why is my following code …

  7. Indexing with pointers - How pointer works with slices?

    May 30, 2020 · Slices in Golang are very lightweight structures - the consists of 3 64 bit values: a pointer to an array with data, current length of the array and a maximal length of the array - so …

  8. go - Using a pointer to array - Stack Overflow

    To ask a question about the Go language, tag it with go, more people will answer; Vatine did that for you. golang is an obsolete tag; as you can see there are 117 questions tagged as go and …

  9. How do I print the pointer value of a Go object? What does the …

    I am just playing around with Go and do not yet have a good mental model of when structs are passed by value or by reference. This may be a very dumb question but I just want to …

  10. Set an int pointer to an int value in Go - Stack Overflow

    Jun 13, 2018 · You have a pointer variable which after declaration will be nil. If you want to set the pointed value, it must point to something. Attempting to dereference a nil pointer is a runtime …