3 ms·
I really want C to have a slice/fat-pointer-array type, because C is the least common denominator for ABIs and any kind of FFI, and since it doesn't have someth
by thayne 4y ago
I really want C to have a slice/fat-pointer-array type, because C is the least common denominator for ABIs and any kind of FFI, and since it doesn't have something like that, it complicates FFI from languages that have a more sane way of handling arrays.
I'd even be happy if the standard just included a macro like:
#define ARRAY(T) struct { T *ptr, size_t len }
Along with a few functions for working with such types.
Although that would be kind of unwieldy to use in C, since you would need a typedef to actually use any specific types.
- uecker 4y agoI am relatively sure we will end up adding a fat pointer next round. So long, you can look at my experiments using a struct type here: https://github.com/uecker/noplate/ https://github.com/uecker/noplate/ The typedef thing will go away with C2X where you do this in place.