diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-09-28 13:51:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 13:51:39 +0200 |
commit | 50b6f6996ab604931d8ee7ca2a26bfdce5559933 (patch) | |
tree | 2c17276e270016cad4fb002d80758fbfa9b272bb /doc | |
parent | 453167a41e4d3b75e14d9102779dc2311672d13f (diff) | |
download | Nim-50b6f6996ab604931d8ee7ca2a26bfdce5559933.tar.gz |
.noalias annotation; frontend support (#15419)
* .noalias annotation; frontend support * added .noalias support to Nim; implements https://github.com/nim-lang/RFCs/issues/204
Diffstat (limited to 'doc')
-rw-r--r-- | doc/manual_experimental.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/manual_experimental.rst b/doc/manual_experimental.rst index a96c121a2..459139f94 100644 --- a/doc/manual_experimental.rst +++ b/doc/manual_experimental.rst @@ -1764,6 +1764,21 @@ via ``.noSideEffect``. The rules 3 and 4 can also be approximated by a different can only passed to a parameter of a ``.noSideEffect`` proc. +Noalias annotation +================== + +Since version 1.4 of the Nim compiler, there is a ``.noalias`` annotation for variables +and parameters. It is mapped directly to C/C++'s ``restrict`` keyword and means that +the underlying pointer is pointing to a unique location in memory, no other aliases to +this location exist. It is *unchecked* that this alias restriction is followed, if the +restriction is violated, the backend optimizer is free to miscompile the code. +This is an **unsafe** language feature. + +Ideally in later versions of the language, the restriction will be enforced at +compile time. (Which is also why the name ``noalias`` was choosen instead of a more +verbose name like ``unsafeAssumeNoAlias``.) + + Strict funcs ============ |