diff --git a/doc/manual.rst b/doc/manual.rst index d9f9cc9b9670..f8d8abbc85e2 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -1282,6 +1282,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