55 |
55 |
56 ## String |
56 ## String |
57 |
57 |
58 *Header file:* [string.h](api/string_8h.html) |
58 *Header file:* [string.h](api/string_8h.html) |
59 |
59 |
|
60 UCX strings come in two variants: immutable (`cxstring`) and mutable (`cxmutstr`). |
|
61 The functions of UCX are designed to work with immutable strings by default but in situations where it is necessary, |
|
62 the API also provides alternative functions that work directly with mutable strings. |
|
63 Functions that change a string in-place are, of course, only accepting mutable strings. |
|
64 |
|
65 When you are using UCX functions, or defining your own functions, you are sometimes facing the "problem", |
|
66 that the function only accepts arguments of type `cxstring` but you only have a `cxmutstr` at hand. |
|
67 In this case you _should not_ introduce a wrapper function that accepts the `cxmutstr`, |
|
68 but instead you should use the `cx_strcast()` function to cast the argument to the correct type. |
|
69 |
|
70 In general, UCX strings are **not** necessarily zero-terminated. If a function guarantees to return zero-terminated |
|
71 string, it is explicitly mentioned in the documentation of the respective function. |
|
72 As a rule of thumb, you _should not_ pass the strings of a UCX string structure to another API without explicitly |
|
73 ensuring that the string is zero-terminated. |
|
74 |
60 ## Buffer |
75 ## Buffer |
61 |
76 |
62 *Header file:* [buffer.h](api/buffer_8h.html) |
77 *Header file:* [buffer.h](api/buffer_8h.html) |
63 |
78 |
64 ## Memory Pool |
79 ## Memory Pool |