diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-12-17 14:20:57 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-12-17 14:20:57 +0100 |
commit | b0134309292e41a9b29777b5bdd79f2a1278a03d (patch) | |
tree | 352e573c59ce22e21d8bfe26d38b1e584e25cd15 /doc | |
parent | 14b9eaee06894f5bf00548117984381d37f16ec7 (diff) | |
download | Nim-b0134309292e41a9b29777b5bdd79f2a1278a03d.tar.gz |
reworked emit pragma; fixes #4730
Diffstat (limited to 'doc')
-rw-r--r-- | doc/manual/pragmas.txt | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/doc/manual/pragmas.txt b/doc/manual/pragmas.txt index a19f41a34..2a276c2e7 100644 --- a/doc/manual/pragmas.txt +++ b/doc/manual/pragmas.txt @@ -26,9 +26,6 @@ It can also be used as a statement, in that case it takes a list of *renamings*. Stream = ref object {.deprecated: [TFile: File, PStream: Stream].} -The ``nimfix`` tool can be used to, without effort, automatically update your -code and refactor it by performing these renamings. - noSideEffect pragma ------------------- @@ -678,14 +675,15 @@ Example: {.push stackTrace:off.} proc embedsC() = var nimVar = 89 - # use backticks to access Nim symbols within an emit section: - {.emit: """fprintf(stdout, "%d\n", cvariable + (int)`nimVar`);""".} + # access Nim symbols within an emit section outside of string literals: + {.emit: ["""fprintf(stdout, "%d\n", cvariable + (int)""", nimVar, ");"].} {.pop.} embedsC() -As can be seen from the example, to Nim symbols can be referred via backticks. -Use two backticks to produce a single verbatim backtick. +For backwards compatibility, if the argument to the ``emit`` statement +is a single string literal, Nim symbols can be referred to via backticks. +This usage is however deprecated. For a toplevel emit statement the section where in the generated C/C++ file the code should be emitted can be influenced via the |