Oh, and we could also be more informative and print the size of an array,
or the number of elements, as clang does.

Yes, that's pretty nice. It helps but the diagnostic must point at
the right dimension. GCC often just points at the whole expression
or some token within it.

void* foo ()
{
    enum { I = 65535, J = 65536, K = 65537, L = 65538, M = 65539 };

    return new int [I][J][K][L][M];
}
z.c:5:24: error: array is too large (65536 elements)
    return new int [I][J][K][L][M];
                       ^

It might be even more helpful if it included the size of each element
(i.e., here, K * L * M byes).

Martin

Reply via email to