3 ms·
That's seems fixable with a standard library, if you define, typedef struct { byte *data; u64 len; } array; typedef struct { byte *data; u64 len; u64 c
by mjburgess 3y ago
That's seems fixable with a standard library, if you define,
typedef struct { byte *data; u64 len; } array;
typedef struct { byte *data; u64 len; u64 cap; } vec;
typedef struct { byte *data; u64 len; } string;
etc.
Then developers will adhere to those apis, so long as, one's own array-struct decays to the above, so there can be standard library fns against the above, eg.,
sort(array *a);
etc.
- teo_zero 3y agoSure, but you lose the simplicity of accessing items with a[index], literals {1, 2, 3}, and initialization.