5 ms·
I'm not familiar with Go, but I'd imagine something like this: const int SomeNumber = 0; // then much later in the program return 3 / SomeNumber; An acc
by jsmeaton 14y ago
I'm not familiar with Go, but I'd imagine something like this:
const int SomeNumber = 0;
// then much later in the program
return 3 / SomeNumber;
An accidental and not immediately obvious divide by constant 0.
- JulianMorrison 14y agoconst weasels = 5 const lawyers = 5 const mustelids = weasels - lawyers feedWeaselsEach(chickenPortions / mustelids)
- netcraft 14y agowould this count as a constant 0 and be caught by the compiler?
- JulianMorrison 14y agoYup. Constants are computed at compile time in Go.