docs/src/modules.md

changeset 325
a3e63cb21e20
parent 321
9af21a50b516
child 326
3dd7d21fb76b
     1.1 --- a/docs/src/modules.md	Tue May 29 10:02:55 2018 +0200
     1.2 +++ b/docs/src/modules.md	Tue May 29 11:05:12 2018 +0200
     1.3 @@ -580,13 +580,17 @@
     1.4         This version is especially useful for function arguments */
     1.5  sstr_t c = S("hello");
     1.6  
     1.7 -/* (4) ST() macro creates sstr_t struct literal using sizeof() */
     1.8 -sstr_t d = ST("hello");
     1.9 +/* (4) SC() macro works like S(), but makes the string immutable using scstr_t.
    1.10 +       (available since UCX 2.0) */
    1.11 +scstr_t d = SC("hello");
    1.12 +
    1.13 +/* (5) ST() macro creates sstr_t struct literal using sizeof() */
    1.14 +sstr_t e = ST("hello");
    1.15  ```
    1.16  
    1.17 -You should not use the `S()` or `ST()` macro with string of unknown origin,
    1.18 -since the `sizeof()` call might not coincide with the string length in those
    1.19 -cases. If you know what you are doing, it can save you some performance,
    1.20 +You should not use the `S()`, `SC()`, or `ST()` macro with string of unknown
    1.21 +origin, since the `sizeof()` call might not coincide with the string length in
    1.22 +those cases. If you know what you are doing, it can save you some performance,
    1.23  because you do not need the `strlen()` call.
    1.24  
    1.25  ### Handling immutable strings
    1.26 @@ -655,6 +659,19 @@
    1.27  
    1.28  The memory pool ensures, that all strings are freed.
    1.29  
    1.30 +### Disabling convenience macros
    1.31 +
    1.32 +If you are experiencing any troubles with the short convenience macros `S()`,
    1.33 +`SC()`, or `ST()`, you can disable them by setting the macro
    1.34 +`UCX_NO_SSTR_SHORTCUTS` before including the header (or via a compiler option).
    1.35 +For the formatting macros `SFMT()` and `PRIsstr` you can use the macro
    1.36 +`UCX_NO_SSTR_FORMAT_MACROS` to disable them.
    1.37 +
    1.38 +Please keep in mind, that after disabling the macros, you cannot use them in
    1.39 +your code *and* foreign code that you might have included.
    1.40 +You should only disable the macros, if you are experiencing a nasty name clash
    1.41 +which cannot be otherwise resolved.
    1.42 +
    1.43  ## Testing
    1.44  
    1.45  *Header file:* [test.h](api/test_8h.html)  

mercurial