summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-09-03 12:06:34 +0200
committerAraq <rumpf_a@web.de>2018-09-03 12:06:34 +0200
commit4e05bca96fb13780b98b2779db6382d7d35ed354 (patch)
tree0570f08bcdd9d71f76e9fa904caed6db54e67525
parentd1e3a7c827e528c8169387936f41cc03fb4ebe9f (diff)
downloadNim-4e05bca96fb13780b98b2779db6382d7d35ed354.tar.gz
manual: add a note about the terminating zero for strings; refs #5596
-rw-r--r--doc/manual.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/manual.rst b/doc/manual.rst
index 7a765ef63..6dc6794f1 100644
--- a/doc/manual.rst
+++ b/doc/manual.rst
@@ -1004,6 +1004,11 @@ All string literals are of the type ``string``. A string in Nim is very
 similar to a sequence of characters. However, strings in Nim are both
 zero-terminated and have a length field. One can retrieve the length with the
 builtin ``len`` procedure; the length never counts the terminating zero.
+
+The terminating zero cannot be accessed unless the string is converted
+to the ``cstring`` type first. The terminating zero assures that this
+conversion can be done in O(1) and without any allocations.
+
 The assignment operator for strings always copies the string.
 The ``&`` operator concatenates strings.