Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
4
votes
Accepted
Why does uint 0 - 20 not cause an underflow?
That's because since solidity 0.8.0 the overflow / underflow are automatically checked :
"Arithmetic operations revert on underflow and overflow. You can use unchecked { ... } to use the previous wrap …
1
vote
Accepted
Where is the single-parameter version of function sub() defined in SafeMath?
The function you have seen in SafeMath.sol :
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
Is the one that is implicitly called with block.number.sub(1). … That is the case because SafeMath.sol is a library that is attached to the type uint256. …