Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on The C23 edition of Modern C is now available for free. Parent comment
int foo(int n, int (*a)[n]) { return (\*a)[5]; } int main() { int a[3]; return foo(ARRAY_SIZE(a), &a); }
int foo(size_t n, int* a) { assert(5 < n); return a[5]; } int main() { int a[3]; return foo(ARRAY_SIZE(a), a); }
Contrast with how simple it is in D:
int foo(int[] a) { return a[5]; } int main() { int[3] a; return foo(a); }
There are no comments on this comment yet.
Contrast with how simple it is in D:
and the proof is shown by array overflow bugs in the wild are stopped cold. It can be that simple and effective in C.