On Tue, 6 Oct 2026, Alejandro Colomar wrote: > > So when you introduce this interaction by adding _Countof on array > > parameters, you need to (a) work out the desired semantics, (b) document > > them, (c) implement them and (d) ensure they are properly covered in the > > testsuite. (Even defining as "not permitted on any parameter with a > > forward declaration" to avoid these issues could be awkward when you might > > not know at the point _Countof is encountered whether a previous parameter > > referenced will turn out to be a forward declaration or not.) > > I've been thinking about this, now that it's more or less certain that > forward parameter declarations won't be standardized. > > I still refuse to define the behavior. I think it's something a > programmer simply shouldn't use at all, and thus a contract for it is > bad. However, I agree it's unnecessarily hostile to make it UB.
When a programmer shouldn't use it at all, that's an argument for defining strict rules (making problem cases into errors, and documenting and testing that), rather than leaving it unspecified. -- Joseph S. Myers [email protected]
