aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/frequently-asked-questions.rst38
-rw-r--r--docs/installing-solidity.rst2
-rw-r--r--docs/introduction-to-smart-contracts.rst2
-rw-r--r--docs/miscellaneous.rst4
-rw-r--r--docs/types.rst7
5 files changed, 12 insertions, 41 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst
index e1a0e91b..bcdfdcd8 100644
--- a/docs/frequently-asked-questions.rst
+++ b/docs/frequently-asked-questions.rst
@@ -143,44 +143,6 @@ arguments for you.
See `ping.sol <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/45_ping.sol>`_ and
`pong.sol <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/45_pong.sol>`_.
-When returning a value of say ``uint`` type, is it possible to return an ``undefined`` or "null"-like value?
-============================================================================================================
-
-This is not possible, because all types use up the full value range.
-
-You have the option to ``throw`` on error, which will also revert the whole
-transaction, which might be a good idea if you ran into an unexpected
-situation.
-
-If you do not want to throw, you can return a pair::
-
- pragma solidity >0.4.23 <0.6.0;
-
- contract C {
- uint[] counters;
-
- function getCounter(uint index)
- public
- view
- returns (uint counter, bool error) {
- if (index >= counters.length)
- return (0, true);
- else
- return (counters[index], false);
- }
-
- function checkCounter(uint index) public view {
- (uint counter, bool error) = getCounter(index);
- if (error) {
- // Handle the error
- } else {
- // Do something with counter.
- require(counter > 7, "Invalid counter value");
- }
- }
- }
-
-
Are comments included with deployed contracts and do they increase deployment gas?
==================================================================================
diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst
index f8de0e8d..2797d8b0 100644
--- a/docs/installing-solidity.rst
+++ b/docs/installing-solidity.rst
@@ -115,7 +115,7 @@ Arch Linux also has packages, albeit limited to the latest development version:
pacman -S solidity
-We distribute the Solidity compiler through Homebrow
+We distribute the Solidity compiler through Homebrew
as a build-from-source version. Pre-built bottles are
currently not supported.
diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst
index 9245300b..34ef012e 100644
--- a/docs/introduction-to-smart-contracts.rst
+++ b/docs/introduction-to-smart-contracts.rst
@@ -400,7 +400,7 @@ within a word). At the time of expansion, the cost in gas must be paid. Memory i
costly the larger it grows (it scales quadratically).
The EVM is not a register machine but a stack machine, so all
-computations are performed on an data area called the **stack**. It has a maximum size of
+computations are performed on a data area called the **stack**. It has a maximum size of
1024 elements and contains words of 256 bits. Access to the stack is
limited to the top end in the following way:
It is possible to copy one of
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index cc2ba801..017d5b81 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -15,6 +15,10 @@ Statically-sized variables (everything except mapping and dynamically-sized arra
- If an elementary type does not fit the remaining part of a storage slot, it is moved to the next storage slot.
- Structs and array data always start a new slot and occupy whole slots (but items inside a struct or array are packed tightly according to these rules).
+For contracts that use inheritance, the ordering of state variables is determined by the
+C3-linearized order of contracts starting with the most base-ward contract. If allowed
+by the above rules, state variables from different contracts do share the same storage slot.
+
.. warning::
When using elements that are smaller than 32 bytes, your contract's gas usage may be higher.
This is because the EVM operates on 32 bytes at a time. Therefore, if the element is smaller
diff --git a/docs/types.rst b/docs/types.rst
index b84d3222..69c846a6 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -13,6 +13,11 @@ Solidity provides several elementary types which can be combined to form complex
In addition, types can interact with each other in expressions containing
operators. For a quick reference of the various operators, see :ref:`order`.
+The concept of "undefined" or "null" values does not exist in Solidity, but newly
+declared variables always have a :ref:`default value<default-value>` dependent
+on its type. To handle any unexpected values, you should use the :ref:`revert function<assert-and-require>` to revert the whole transaction, or return a
+tuple with a second `bool` value denoting success.
+
.. index:: ! value type, ! type;value
Value Types
@@ -273,7 +278,7 @@ Example::
when the call returns. The regular way to interact with other contracts
is to call a function on a contract object (``x.f()``).
-:: note::
+.. note::
Previous versions of Solidity allowed these functions to receive
arbitrary arguments and would also handle a first argument of type
``bytes4`` differently. These edge cases were removed in version 0.5.0.