Right, but in C99 the expression between the square brackets doesn't
have to be a constant-expression, so
char arr['a','b','c'];
declares a variable length array (even though the length can be
determined at compilation time).
True, but only if "arr" appears in a context in which VLAs are
allowed. So it is always invalid in C89, and sometimes valid
in C99:
char wrong[1,2]; /* error in both C89 and C99 */
void fn(void) {
char ok_and_VLA[1,2]; /* error in C89, otherwise VLA of size 2 */
...
}
Interestingly, one can test for "VLA-ness" at runtime by applying
the sizeof operator, whose operand *is* evaluated if the operand
is a VLA. I am not quite sure whether this can be used to detect
whether a given C99 compiler treats (1,2) as a constant-expression
in the "ok_and_VLA" case above.