News for hackers. Stuff that matters.
Re:What Golang Is and Is Not by SamReidHughes on Monday August 22, 2016 @03:20PM (#12338687)
Your example doesn't produce SIGSEGV for me. It prints out the text, "nil".

However, if I write

    echo(cfg.someSetting[0])
it will segfault. This makes sense because it dereferences a null pointer (in Nim-speak, a nil value). I would guess that's what you experienced.

Dereferencing a null pointer is not unsafe. The program cleanly exits. Compiling that via C is sketchy though, because the C compiler may treat provable null pointer dereferences as undefined behavior.

There are no comments on this comment yet.