3 ms·
Two bottles of beer on the wall, two bottles of beer. Take one down, pass it around, one bottle of beer on the wall. One bottle of beer on the wall, one bottl
by tptacek 9y ago
Two bottles of beer on the wall, two bottles of beer.
Take one down, pass it around, one bottle of beer on the wall.
One bottle of beer on the wall, one bottle of beer.
Take it down, pass it around, zero bottles of beer on the wall.
Zero bottles of beer on the wall, zero bottles of beer.
Take one down, pass it around, four billion, two hundred ninety-four million, nine hundred sixty-seven thousand, two hundred ninety-five bottles of beer on the wall.
(Yes, you pretty much have it in your question; the Google search you want to make to learn more is [integer overflow]).
- zerokernel 9y agoAnd various undefined behaviours (signed overflow etc.) colluding against the programmer to the effect that compilers sometimes delete range-checking code. Integer promotion rules are not simple, either. Integer width rules, far from simple.