I propose to deprecate in C++23:
1) mixed pointer and array comparisons:
int a[2]; int b[2];
a == &b[0];
Okay... but why "mixed"? Why not just deprecate all relational/equality operators where either side (or both) is an array?
bool one(const char *p) { return p == "hello"; } // definitely a bug
bool two(int x, int y) { int a[2] = {x,y}; int b[2] = {3,4}; return (a == b); } // definitely a bug
const char *three(const char *p) { static const char arr[] = "hello"; return (p == arr) ? nullptr : arr; } // not a bug, but perhaps expendable if its sacrifice buys us something good
GCC, Clang, and MSVC all warn on `one`.
Clang warns twice on `two`, even going so far as to claim that comparison between two arrays is already deprecated(!).
Nobody warns on `three`.
2) array decl in func parameters:
void foo(int a[2]);
int main(int argc, char *argv[])
to ever permit a general deprecation of the notation.
Vendors could certainly start warning on it, though.
Does clang-tidy support a check for "misleading array syntax in parameter declaration"?
–Arthur