Re:The Logical Disaster of Null
by ychen306 on Wednesday May 09, 2018 @11:26PM
(#17036167)
Why is null in Go unsafe?
[ Parent
| on HN ]
res, err := http.Get("wcpgw")
defer res.Body.Close()
...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x5ed9af]
Re:The Logical Disaster of Null
by seandougall on Wednesday May 09, 2018 @11:37PM
(#17036185)
Presumably because there’s no language-level way to guarantee a pointer to be non-nil at compile time, combined with nil dereferencing being a crash. Not unsafe in the security sense, but definitely unsafe in the “can I count on my program to run” sense.