I was surprised to find out that the returns
clause in function declaration seems not to be enforced. That is, the following code compiles in browser-solidity (foo
returns 0
when invoked):
pragma solidity ^0.4.4;
contract TestContract {
function foo() returns (uint) {
uint b = 3+5;
//return b;
}
}
Isn't it supposed not to type-check if the function that is declared to return something in fact does not? What is the rationale behind this design decision?