[Ethereum] How are solidity integer overflows handled

overflowsolidity

uint8 x = 255;

x += 10;

Is x going to be 0 or 9?

Best Answer

x will be 9.

Use this code and How to quickly test a Solidity function?

contract C {
    function test() returns(uint) {
        uint8 x = 255;
        x += 10;
        return x;
    }
}

Decoded: uint256: 9