You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-11Lines changed: 19 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,21 +8,25 @@ Lightweight macro helpers for dynamic arrays in C with safer edge-case handling
8
8
generate_array_type(int);
9
9
```
10
10
11
-
This creates `Array(int)`and `Slice(int)`.
11
+
This creates `Array(int)`, `Slice(int)`, and `Span(int)`.
12
12
13
13
## API safety tiers
14
14
15
15
Use checked macros by default. Keep unchecked macros only for compatibility or explicitly performance-focused paths where preconditions are guaranteed.
16
16
17
17
## Checked APIs (recommended)
18
18
19
-
- `array_make(T, size)`: allocate array with initial capacity (`size` can be `0`).
19
+
- `array_make(T, size)`: allocate array with initial capacity; use `8` as a practical default when size is unknown (`0` is allowed when you want no spare slots).
20
20
- `array_free(arr)`: free array memory.
21
21
- `array_reserve(arr, min_capacity)`: ensure capacity, returns `bool` and may update `arr` after `realloc`.
0 commit comments