Andrew Suffield <[EMAIL PROTECTED]> writes: > Package: gcc-3.3 > > [This is also present in gcc-3.2, and probably all 3.x versions; it is > inapplicable for 2.95, which didn't support dynamic arrays]
Huh? It did. > int main(void) > { > int foo = 0; > int bar; > int len = 5; > switch(foo) > { > case 0: > bar = 1; > char buf[len]; > } > } > > I'm not sure whether the original code is supposed to compile or not; I don't see why it shouldn't. > I suspect that it currently miscompiles. Indeed. Looking at the assembly, even for int f(int len) { if (0) { char buf[len]; } } code is generated to allocate "len" bytes, which is bad, since len might be -1 or something. > What the heck is the scope of a variable declared in this position? Till the end of the containing block. -- Falk