aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-08-01 18:40:24 +0800
committerGitHub <noreply@github.com>2016-08-01 18:40:24 +0800
commit66133469e9422377747ff16f23b849e37f673ef1 (patch)
treea40531df98fb3f4d1a28c823d3ce717e25889651 /docs
parent8c5a56d8648c9722d96638bf6dc1be94c7828cb3 (diff)
parent5687beb424663871d3d59c6bd12d71fff79d5200 (diff)
downloaddexon-solidity-66133469e9422377747ff16f23b849e37f673ef1.tar.gz
dexon-solidity-66133469e9422377747ff16f23b849e37f673ef1.tar.zst
dexon-solidity-66133469e9422377747ff16f23b849e37f673ef1.zip
Merge pull request #732 from Denton-L/document-precedence
Document precedence
Diffstat (limited to 'docs')
-rw-r--r--docs/control-structures.rst2
-rw-r--r--docs/miscellaneous.rst63
-rw-r--r--docs/types.rst3
3 files changed, 67 insertions, 1 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index f30a5bdd..9d7ebeac 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -113,7 +113,7 @@ The evaluation order of expressions is not specified (more formally, the order
in which the children of one node in the expression tree are evaluated is not
specified, but they are of course evaluated before the node itself). It is only
guaranteed that statements are executed in order and short-circuiting for
-boolean expressions is done.
+boolean expressions is done. See :ref:`order` for more information.
.. index:: ! assignment
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index 9b067fb1..76485745 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -202,6 +202,69 @@ Tips and Tricks
Cheatsheet
**********
+.. index:: precedence
+
+.. _order:
+
+Order of Precedence of Operators
+================================
+
+The following is the order of precedence for operators, listed in order of evaluation.
+
++------------+-------------------------------------+--------------------------------------------+
+| Precedence | Description | Operator |
++============+=====================================+============================================+
+| *1* | Postfix increment and decrement | ``++``, ``--`` |
++ +-------------------------------------+--------------------------------------------+
+| | Function-like call | ``<func>(<args...>)`` |
++ +-------------------------------------+--------------------------------------------+
+| | Array subscripting | ``<array>[<index>]`` |
++ +-------------------------------------+--------------------------------------------+
+| | Member access | ``<object>.<member>`` |
++ +-------------------------------------+--------------------------------------------+
+| | Parentheses | ``(<statement>)`` |
++------------+-------------------------------------+--------------------------------------------+
+| *2* | Prefix increment and decrement | ``++``, ``--`` |
++ +-------------------------------------+--------------------------------------------+
+| | Unary plus and minus | ``+``, ``-`` |
++ +-------------------------------------+--------------------------------------------+
+| | Unary operations | ``after``, ``delete`` |
++ +-------------------------------------+--------------------------------------------+
+| | Logical NOT | ``!`` |
++ +-------------------------------------+--------------------------------------------+
+| | Bitwise NOT | ``~`` |
++------------+-------------------------------------+--------------------------------------------+
+| *3* | Exponentiation | ``**`` |
++------------+-------------------------------------+--------------------------------------------+
+| *4* | Multiplication, division and modulo | ``*``, ``/``, ``%`` |
++------------+-------------------------------------+--------------------------------------------+
+| *5* | Addition and subtraction | ``+``, ``-`` |
++------------+-------------------------------------+--------------------------------------------+
+| *6* | Bitwise shift operators | ``<<``, ``>>`` |
++------------+-------------------------------------+--------------------------------------------+
+| *7* | Bitwise AND | ``&`` |
++------------+-------------------------------------+--------------------------------------------+
+| *8* | Bitwise XOR | ``^`` |
++------------+-------------------------------------+--------------------------------------------+
+| *9* | Bitwise OR | ``|`` |
++------------+-------------------------------------+--------------------------------------------+
+| *10* | Inequality operators | ``<``, ``>``, ``<=``, ``>=`` |
++------------+-------------------------------------+--------------------------------------------+
+| *11* | Equality operators | ``==``, ``!=`` |
++------------+-------------------------------------+--------------------------------------------+
+| *12* | Logical AND | ``&&`` |
++------------+-------------------------------------+--------------------------------------------+
+| *13* | Logical OR | ``||`` |
++------------+-------------------------------------+--------------------------------------------+
+| *14* | Ternary operator | ``<conditional> ? <if-true> : <if-false>`` |
++------------+-------------------------------------+--------------------------------------------+
+| *15* | Assignment operators | ``=``, ``|=``, ``^=``, ``&=``, ``<<=``, |
+| | | ``>>=``, ``+=``, ``-=``, ``*=``, ``/=``, |
+| | | ``%=`` |
++------------+-------------------------------------+--------------------------------------------+
+| *16* | Comma operator | ``,`` |
++------------+-------------------------------------+--------------------------------------------+
+
.. index:: block, coinbase, difficulty, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, now, gas price, origin, sha3, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, this, super, selfdestruct, balance, send
Global Variables
diff --git a/docs/types.rst b/docs/types.rst
index 50e86ed0..d7681ee5 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -12,6 +12,9 @@ see :ref:`type-deduction` below) at
compile-time. Solidity provides several elementary types which can be combined
to form complex types.
+In addition, types can interact with each other in expressions containing
+operators. For a quick reference of the various operators, see :ref:`order`.
+
.. index:: ! value type, ! type;value
Value Types