Closed Mengyuan410 closed 2 years ago
Yeah exactly, that is the case. however, I wouldn't trust the grammar file to get it right, so I would always double check the standard.
However, you can also try the following command, which can maybe quickly tell you if you are obeying the C89 standard (but it might not always error out if you are not obeying it).
gcc -std=c89 -pedantic -Wall -Wextra -Wundef -Werror main.c
That’s right. In newer versions of C, the programmer has more flexibility about where they can declare variables. But that won’t be exploited in the test cases I give your compiler.
Hello Sir, may I ask something about the ANSI C specification? This is the standard parser for ANSI C. Does it mean for ANSI C, declaration can only happen before statement in compound statement? And the following situation (i.e. declaration and statement mixing together) won't happen?