Unfortunately working with dynamically-allocated buffers is still a thing; adding array syntax just favors one form of size specification without solving the other case. Although C is usable on many types of hardware, interesting things could be done, e.g. on desktop OSes if certain hardware-specific extensions were made. One of the things I wish we could do with our now-absurdly-large pointers (64-bit) is to reserve…
> Unfortunately working with dynamically-allocated buffers is still a thing; adding array syntax just favors one form of size specification without solving the other case. All that is needed is a mechanism for forming a fat pointer from a pointer and a length. In D this looks like: int* p = cast(int*)malloc(length * sizeof(int)); if (!p) fatalError(); int[] a = p[0 .. length]; ... int x = a[length + 1]; // runtime er…
struct foo {
int a[10];
} f;
func(&f);