mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Explain pragmas.
This commit is contained in:
parent
fcb48bceff
commit
2c613127c9
@ -303,6 +303,8 @@ CMake options
|
|||||||
|
|
||||||
If you are interested what CMake options are available run ``cmake .. -LH``.
|
If you are interested what CMake options are available run ``cmake .. -LH``.
|
||||||
|
|
||||||
|
.. _smt_solvers_build:
|
||||||
|
|
||||||
SMT Solvers
|
SMT Solvers
|
||||||
-----------
|
-----------
|
||||||
Solidity can be built against SMT solvers and will do so by default if
|
Solidity can be built against SMT solvers and will do so by default if
|
||||||
|
@ -2,15 +2,23 @@
|
|||||||
Layout of a Solidity Source File
|
Layout of a Solidity Source File
|
||||||
********************************
|
********************************
|
||||||
|
|
||||||
Source files can contain an arbitrary number of contract definitions, include directives
|
Source files can contain an arbitrary number of
|
||||||
and pragma directives.
|
:ref:`contract definitions<contract_structure>`, import_ directives
|
||||||
|
and :ref:`pragma directives<pragma>`.
|
||||||
|
|
||||||
|
.. index:: ! pragma
|
||||||
|
|
||||||
|
.. _pragma:
|
||||||
|
|
||||||
|
Pragmas
|
||||||
|
=======
|
||||||
|
|
||||||
.. index:: ! pragma, version
|
.. index:: ! pragma, version
|
||||||
|
|
||||||
.. _version_pragma:
|
.. _version_pragma:
|
||||||
|
|
||||||
Version Pragma
|
Version Pragma
|
||||||
==============
|
--------------
|
||||||
|
|
||||||
Source files can (and should) be annotated with a so-called version pragma to reject
|
Source files can (and should) be annotated with a so-called version pragma to reject
|
||||||
being compiled with future compiler versions that might introduce incompatible
|
being compiled with future compiler versions that might introduce incompatible
|
||||||
@ -35,6 +43,44 @@ the exact version of the compiler, so that bugfix releases are still possible.
|
|||||||
It is possible to specify much more complex rules for the compiler version,
|
It is possible to specify much more complex rules for the compiler version,
|
||||||
the expression follows those used by `npm <https://docs.npmjs.com/misc/semver>`_.
|
the expression follows those used by `npm <https://docs.npmjs.com/misc/semver>`_.
|
||||||
|
|
||||||
|
.. index:: ! pragma, experimental
|
||||||
|
|
||||||
|
.. _experimental_pragma:
|
||||||
|
|
||||||
|
Experimental Pragma
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
The second pragma is the experimental pragma. It can be used to enable
|
||||||
|
features of the compiler or language that are not yet enabled by default.
|
||||||
|
The following experimental pragmas are currently supported:
|
||||||
|
|
||||||
|
|
||||||
|
ABIEncoderV2
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
The new ABI encoder is able to encode and decode arbitrarily nested
|
||||||
|
arrays and structs. It produces less optimal code (the optimizer
|
||||||
|
for this part of the code is still under development) and has not
|
||||||
|
received as much testing as the old encoder. You can activate it
|
||||||
|
using ``pragma experimental ABIEncoderV2;``.
|
||||||
|
|
||||||
|
SMTChecker
|
||||||
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
This component has to be enabled when the Solidity compiler is built
|
||||||
|
and therefore it is not available in all Solidity binaries.
|
||||||
|
The :ref:`build instructions<smt_solvers_build>` explain how to activate this option.
|
||||||
|
It is activated for the Ubuntu PPA releases in most versions,
|
||||||
|
but not for solc-js, the Docker images, Windows binaries or the
|
||||||
|
statically-built Linux binaries.
|
||||||
|
|
||||||
|
If you use
|
||||||
|
``pragma experimental SMTChecker;``, then you get additional
|
||||||
|
safety warnings which are obtained by querying an SMT solver.
|
||||||
|
The component does not yet support all features of the Solidity language
|
||||||
|
and likely outputs many warnings. In case it reports unsupported
|
||||||
|
features, the analysis may not be fully sound.
|
||||||
|
|
||||||
.. index:: source file, ! import
|
.. index:: source file, ! import
|
||||||
|
|
||||||
.. _import:
|
.. _import:
|
||||||
|
Loading…
Reference in New Issue
Block a user