add web documentation for strings

Tue, 27 Jun 2023 18:24:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 27 Jun 2023 18:24:28 +0200
changeset 723
c33e0ac069dd
parent 722
adc3c48dd3af
child 724
5e7b1951dc80

add web documentation for strings

docs/src/features.md file | annotate | diff | comparison | revisions
--- a/docs/src/features.md	Tue Jun 27 18:10:34 2023 +0200
+++ b/docs/src/features.md	Tue Jun 27 18:24:28 2023 +0200
@@ -57,6 +57,21 @@
 
 *Header file:* [string.h](api/string_8h.html)
 
+UCX strings come in two variants: immutable (`cxstring`) and mutable (`cxmutstr`).
+The functions of UCX are designed to work with immutable strings by default but in situations where it is necessary,
+the API also provides alternative functions that work directly with mutable strings.
+Functions that change a string in-place are, of course, only accepting mutable strings.
+
+When you are using UCX functions, or defining your own functions, you are sometimes facing the "problem",
+that the function only accepts arguments of type `cxstring` but you only have a `cxmutstr` at hand.
+In this case you _should not_ introduce a wrapper function that accepts the `cxmutstr`,
+but instead you should use the `cx_strcast()` function to cast the argument to the correct type.
+
+In general, UCX strings are **not** necessarily zero-terminated. If a function guarantees to return zero-terminated
+string, it is explicitly mentioned in the documentation of the respective function.
+As a rule of thumb, you _should not_ pass the strings of a UCX string structure to another API without explicitly
+ensuring that the string is zero-terminated.
+
 ## Buffer
 
 *Header file:* [buffer.h](api/buffer_8h.html)  

mercurial