diff --git a/GoForCPPProgrammers.md b/GoForCPPProgrammers.md index 9c18a88e..3592138d 100644 --- a/GoForCPPProgrammers.md +++ b/GoForCPPProgrammers.md @@ -23,8 +23,7 @@ Interfaces are also used where C++ uses templates.
  • Go provides automatic garbage collection of allocated memory. It is not necessary (or possible) to release memory explicitly. There is no need to worry about heap-allocated vs. stack-allocated storage, new vs. malloc, or delete vs. delete[] vs. free. There is no need to separately manage std::unique_ptr, std::shared_ptr, std::weak_ptr, std::auto_ptr, and ordinary, "dumb" pointers. Go's run-time system handles all of that error-prone code on the programmer's behalf.
  • -
  • Go has pointers but not pointer arithmetic. Go pointers therefore more closely resemble C++ references. One cannot use a Go pointer
    -variable to walk through the bytes of a string, for example. Slices, discussed further below, satisfy most of the need for pointer arithmetic.
  • +
  • Go has pointers but not pointer arithmetic. Go pointers therefore more closely resemble C++ references. One cannot use a Go pointer variable to walk through the bytes of a string. Slices, discussed further below, satisfy most of the need for pointer arithmetic.
  • Go is "safe" by default. Pointers cannot point to arbitrary memory, and buffer overruns result in crashes, not security exploits. The unsafe package lets programmers bypass some of Go's protection mechanisms where explicitly requested.