Re:“People who implement new and improved interfaces always ...
by joveian on Saturday September 12, 2015 @06:21PM
(#10209592)
I just recently discovered that modern C actually has syntax for forcing sized arrays as function arguments. You can do:
foo(size_t n, char arr[restrict static n])
The static qualifier here means "no really, I actually want the compiler to complain if the passed array isn't the size indicated". (because C doesn't have enough different meanings for the word "static" :( ). I haven't seen this in the wild yet or checked if gcc and clang actually implement it usefully, but it seems like it could be quite useful.
My article about it:
http://digitalmars.com/articles/b44.html