3 ms·
> C is much more forgiving :). I think this is confusing being permissible with difficulty. Because C is permissible, it makes writing correct code in it hard.
by leshow 9y ago
> C is much more forgiving :).
I think this is confusing being permissible with difficulty. Because C is permissible, it makes writing correct code in it hard. The fact that the Go compiler has a (relatively) simple type system and is able to point out mistakes like the ones you mentioned makes it much easier to write correct code.
I'd also just like to point out most of the things you list about Go won't cause a crash or undefined behaviour if you were able to leave them in anyway.
As pointed out elsewhere in this thread, interface{} isn't the same as void. void will let you reference anything as a type unsafely leading to undefined behaviour. interface{} carries type information, and while it does cause crashes, it doesn't lead to undefined behaviour.
Also, how is memory management in C easier? Leaking memory is the least of your worries, you could double free, null ptr access, invalid free, have dangling ptrs, etc. Lots of these things are taken care of by Go's GC so you don't have to worry about it.