diff options
-rw-r--r-- | doc/manual.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/manual.rst b/doc/manual.rst index fa28582a7..bfcce24cf 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -1280,6 +1280,20 @@ string from a cstring: var cstr: cstring = str var newstr: string = $cstr +``cstring`` literals shouldn't be modified. + +.. code-block:: nim + var x = cstring"literals" + x[1] = 'A' # This is wrong!!! + +If the ``cstring`` originates from a regular memory (not read-only memory), +it can be modified: + +.. code-block:: nim + var x = "123456" + var s: cstring = x + s[0] = 'u' # This is ok + Structured types ---------------- A variable of a structured type can hold multiple values at the same |