--- a/docs/Writerside/topics/array_list.h.md Sat Oct 11 15:42:48 2025 +0200 +++ b/docs/Writerside/topics/array_list.h.md Sun Oct 12 20:21:56 2025 +0200 @@ -79,10 +79,10 @@ cx_array_initialize_a(mpool->allocator, data.my_array, 16); ``` -> The aforementioned macros make your life simpler, but keep in mind that using them is not mandatory. -> All other macros continue to work perfectly, if you declare and initialize your array manually, as long as you use +> The aforementioned macros simplify your life, but keep in mind that using them is not mandatory. +> All other macros continue to work perfectly if you declare and initialize your array manually, as long as you use > the naming convention to suffix the size variable with `_size` and the capacity variable with `_capacity`. -> Also you can freely decide in which order you want to declare the variables. +> Also, you can freely decide in which order you want to declare the variables. > > For example, when you have multiple arrays in your struct with 8-bit `size_type` (because in your use case you don't expect more than 255 elements), > it is favorable to group all pointers and then declare the size and capacity variables to avoid padding between the array declarations. @@ -110,10 +110,10 @@ extern CxArrayReallocator* cx_array_default_reallocator; ``` -The main purpose of the functions defined in the array list header, -is to make it easier to write to an array without caring too much about a possibly needed reallocation. +The main purpose of the functions defined in the array list header +is to make it easier to write to an array without caring too much about a possibly necessary reallocation. -This is realized by passing a reallocator to the various functions which specifies how an array shall be reallocated when needed. +This is realized by passing a reallocator to the various functions that specify how an array shall be reallocated when needed. The default `cx_array_default_reallocator` simply defers to the [default allocator](allocator.h.md#default-allocator). @@ -125,7 +125,7 @@ This allows you to allocate an array on the stack and instruct UCX to automatically move it to heap memory when the capacity is exceeded. Combined with a UCX [memory pool](mempool.h.md) this can be a powerful tool for local arrays -which are expected to stay within the bounds of the stack memory most of the time, but are also allowed to sometimes grow their capacity when needed. +which are expected to stay within the bounds of the stack memory most of the time, but are also allowed to sometimes grow their capacity. ## Reserve @@ -146,9 +146,9 @@ The `array` argument is a pointer to the location of the target array pointer. The reason for this additional indirection is that this function writes -a new pointer back to that variable, if the array needed to be reallocated. +a new pointer back to that variable if the array needed to be reallocated. -If reallocation fails, this function returns non-zero leaving the array as it was. +If reallocation fails, this function returns non-zero, leaving the array as it was. Otherwise, the function returns zero. If `*size + elem_count` does not exceed the current `*capacity`, this function does nothing and simply returns zero. @@ -156,7 +156,7 @@ If reallocation was necessary but failed, this function returns non-zero. The actual data type of `size` and `capacity` can be a pointer to an arbitrary integer whose byte-width is determined by the `width` argument. -On 32-bit platforms the widths 1, 2, and 4 are supported and on 64-bit platforms, additionally a width of 8 is supported. +On 32-bit platforms the widths 1, 2, and 4 are supported, and on 64-bit platforms a width of 8 is also supported. Passing zero as argument makes the function assume the native width for size arguments `sizeof(size_t)`. The convenience macros take the _name_ of an array variable and invoke the function by deducing the other arguments @@ -164,7 +164,7 @@ The reallocator used by the `cx_array_simple_reserve()` macro is the `cx_array_default_reallocator`. > While the actual integer type for `size` and `capacity` can be chosen freely, it must be _the same_ for both variables. -> For example it is not allowed, and it does not make any sense either, to use a 16-bit integer for the size, but a 32-bit integer for the capacity. +> For example, it is not allowed, and it does not make any sense either, to use a 16-bit integer for the size, but a 32-bit integer for the capacity. ## Copy @@ -194,7 +194,7 @@ * the data in the target array is overwritten - if you want to insert data, you first need to copy the existing data to the end of the array and then copy the new data in a separate call > If you are using `cx_array_reserve()` already in your program, there is no need to call `cx_array_copy()` or any of the convenience macros anymore. -> In other words: if you already guarantee, by any means, that no reallocation is necessary when writing to your array, +> In other words: if you already guarantee, by any means that no reallocation is necessary when writing to your array, > it is strongly recommended to use standard library functions or direct index-based access instead of the UCX functions, > which only purpose is to make it easier for you to guarantee that your array's capacity is large enough to hold new elements. @@ -307,12 +307,12 @@ Otherwise, the function returns `size`. The functions `cx_array_binary_search_inf()` and `cx_array_binary_search_sup()` are equivalent, -except that they return the index of the closest element, if the searched element is not found. -The former function returns the closest element that is less or equal (greatest lower bound / infimum), -and the latter function returns the closest element that is larger or equal (least upper bound / supremum) +except that they return the index of the closest element if the searched element is not found. +The former function returns the closest element that is less or equal (the greatest lower bound / infimum), +and the latter function returns the closest element that is larger or equal (the least upper bound / supremum) than the searched element. -> Note, that all of the above functions are only well-defined on arrays which are sorted with respect to the given compare function. +> Note that all of the above functions are only well-defined on arrays which are sorted with respect to the given compare function. > > This can, for example, easily be achieved by calling the standard library's `qsort()` function. >{style="note"}