Szabolcs said:
Is the following legal?
void fun(int N) {
int arr[N];
}
gcc and Digital Mars accept it, but msvc complains that it wants a
constant expression.
This would have to be an extension for these compilers. Arrays require a
integral constant expression [dcl.array] which is defined in [expr.const]
as:
"An integral constant expression can involve only literals (2.13),
enumerators, const variables or static data members of integral or
enumeration types initialized with constant expressions (8.5), nontype
template parameters of integral or enumeration types, and sizeof
expressions. Floating literals (2.13.3) can appear only if they are cast to
integral or enumeration types."
Hope that helps.
joe