R
Robert
#include <stdio.h>
int main() {
switch (29) {
case 29:
int msglen = 22;
printf("Hello\n");
};
return 0;
}
When I try to compile the above code with gcc 3.3.4 on linux, I get the
following error:
bug.c: In function `main':
bug.c:6: error: parse error before "int"
Placing a statement such as printf, or even just a plain empty statement
(";") before "int msglen = 22;" makes it compile and work fine. Is
there some rule forbidding declaring variables directly after case
statements, or could it possibly be a bug with gcc? I'm not too keen to
try updating gcc since compiling kernels is apparently very touchy with
compiler versions.
Thanks in advance,
Robert
int main() {
switch (29) {
case 29:
int msglen = 22;
printf("Hello\n");
};
return 0;
}
When I try to compile the above code with gcc 3.3.4 on linux, I get the
following error:
bug.c: In function `main':
bug.c:6: error: parse error before "int"
Placing a statement such as printf, or even just a plain empty statement
(";") before "int msglen = 22;" makes it compile and work fine. Is
there some rule forbidding declaring variables directly after case
statements, or could it possibly be a bug with gcc? I'm not too keen to
try updating gcc since compiling kernels is apparently very touchy with
compiler versions.
Thanks in advance,
Robert