On Tue, Mar 14, 2017 at 2:58 PM Eyal Posener <pose...@gmail.com> wrote:

> So my question is: why does go allow that, and for example panics on
index out of range of an array? Doesn't it make sense that it also should
panic in this case?

Accessing an array using an out-of-bound index cannot be intended, it can
corrupt memory and crash the program.

vs

Wrapping-round integers is sometimes exactly what correct code relies upon.
Disallowing it means more boundary condition checking both in source and in
binary, and worse run-time performance of such code.

BTW, its not only --, the same applies to ++, +, -, *, << and the
respective asops (at least).

-- 

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to