https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117810

--- Comment #2 from felix-gcc at fefe dot de ---
Hmm, now that you mention it explicitly... Just like C++ iterators, max does
not actually point at the last element in the array but at the first element
behind the array.

That appears to be more natural in C to me. Like you do in a for loop iterating
over an array:

  for (i=0; i<n; ++i) { ... a[i] ... }

n is not the index of the last element in the array but the one after, as
counting starts with 0.

Also, one thing I have wondered for a while now: Since the compiler can do
constexpr stuff for C++, can't we leverage that in attributes? Allow little
expressions maybe?

If we had that, we could even do attributes declaring pre- and postconditions.
That way we wouldn't need to have special attributes for things like "this
pointer can't be NULL", that could be a simple expression.

Reply via email to