@@ -3,33 +3,43 @@ Solidity v0.8.0 Breaking Changes
3
3
********************************
4
4
5
5
This section highlights the main breaking changes introduced in Solidity
6
- version 0.8.0, along with the reasoning behind the changes and how to update
7
- affected code.
6
+ version 0.8.0.
8
7
For the full list check
9
8
`the release changelog <https://github.com/ethereum/solidity/releases/tag/v0.8.0 >`_.
10
9
11
- Semantic and Syntactic Changes
12
- ==============================
10
+ Silent Changes of the Semantics
11
+ ===============================
13
12
14
- This section lists changes where you have to modify your code
15
- and it does something else afterwards.
13
+ This section lists changes where existing code changes its behaviour without
14
+ the compiler notifying you about it.
15
+
16
+ * Arithmetic operations revert on underflow and overflow. You can use ``unchecked { ... } `` to use
17
+ the previous wrapping behaviour.
18
+
19
+ Checks for overflow are very common, so we made them the default to increase readability of code,
20
+ even if it comes at a slight increase of gas costs.
16
21
17
- * Explicit conversions from negative literals and literals larger than ``type(uint160).max `` to ``address `` are now disallowed.
18
22
* Exponentiation is right associative, i.e., the expression ``a**b**c `` is parsed as ``a**(b**c) ``.
19
23
Before 0.8.0, it was parsed as ``(a**b)**c ``.
20
24
21
- Semantic only Changes
22
- =====================
25
+ This is the common way to parse the exponentiation operator.
26
+
27
+ * Failing assertions and other internal checks like division by zero or arithmetic overflow do
28
+ not use the invalid opcode but instead the revert opcode.
29
+ More specifically, they will use error data equal to a function call to ``Panic(uint256) `` with an error code specific
30
+ to the circumstances.
23
31
24
- * Failing assertions (and other internal checks like division by zero) do not use the invalid opcode anymore but instead revert
25
- with error data equal to a function call to `` Panic(uint256) `` with an error code specific to the circumstances .
32
+ This will save gas on errors while it still allows static analysis tools to distinguish
33
+ these situations from a revert on invalid input, like a failing `` require `` .
26
34
27
- This will save gas on errors while it still allows static analysis tools to detect these situations.
35
+ New Restrictions
36
+ ================
28
37
38
+ * Explicit conversions from negative literals and literals larger
39
+ than ``type(uint160).max `` to ``address `` are disallowed.
29
40
30
- Syntactic Only Changes
31
- ======================
41
+ The previous behaviour was likely ambiguous.
32
42
33
43
* The global functions ``log0 ``, ``log1 ``, ``log2 ``, ``log3 `` and ``log4 `` have been removed.
34
44
35
- These are low-level functions that were largely unused. Their behaviour can be accessed from inline assembly.
45
+ These are low-level functions that were largely unused. Their behaviour can be accessed from inline assembly.
0 commit comments