Alejandro Colomar <a...@kernel.org> writes: >> > A more interesting feature is in the works: using countof() on array >> > parameters. This needs compiler magic: >> > >> > void >> > foo(size_t n, int a[n]) >> > { >> > for (size_t i = 0; i < _Countof(a); i++) >> > a[i] = 0; >> > } >> > >> > I've implemented this for GCC, but a few corner cases still need work. >> > Essentially, I need to implement some diagnostics to prevent stupid >> > things. This is being discussed in the C Committee too, although I >> > don't want to formally propose it for standardization before having it >> > in GCC. >> > >> > I expect this will be ready in GCC 17. >> >> Cool! Ritchie's rolling over in his grave to see C approaching full >> language support for container iterators like this. :P > > Actually, I think this is something that was originally devised by K&R, > and I'm just filling the gaps. I can't see another reason they allowed > using array notation in parameters, if they didn't want them to behave > like that. > > I'm curious about what K has to say about this feature, if he would know > about it.
You can try to contact him through his public Princeton email. I'm not not sure how much spam he gets, but I would assume that he is interested in answering whether or not this feature was considered/attempted. Collin