docs/src/modules.md

changeset 321
9af21a50b516
parent 314
5d28dc8f0765
child 325
a3e63cb21e20
     1.1 --- a/docs/src/modules.md	Wed May 16 19:01:21 2018 +0200
     1.2 +++ b/docs/src/modules.md	Wed May 16 19:27:45 2018 +0200
     1.3 @@ -589,6 +589,25 @@
     1.4  cases. If you know what you are doing, it can save you some performance,
     1.5  because you do not need the `strlen()` call.
     1.6  
     1.7 +### Handling immutable strings
     1.8 +
     1.9 +*(Since: UCX 2.0)*
    1.10 +
    1.11 +For immutable strings (i.e. `const char*` strings), UCX provides the `scstr_t`
    1.12 +type, which works exactly as the `sstr_t` type but with a pointer
    1.13 +to `const char`. All UCX string functions come in two flavors: one that enforces
    1.14 +the `scstr_t` type, and another that usually accepts both types and performs
    1.15 +a conversion automatically, if necessary.
    1.16 +
    1.17 +There are some exceptions to this rule, as the return type may depend on the
    1.18 +argument type.
    1.19 +E.g. the `sstrchr()` function returns a substring starting at
    1.20 +the first occurrence of the specified character.
    1.21 +Since this substring points to the memory of the argument string, it does not
    1.22 +accept `scstr_t` as input argument, because the return type would break the
    1.23 +constness.
    1.24 +
    1.25 +
    1.26  ### Finding the position of a substring
    1.27  
    1.28  The `sstrstr()` function gives you a new `sstr_t` object starting with the

mercurial