We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've got asked this frequently, that I think is worth pointing out, as it might be useful for writing test cases etc.
To force gcc to throw and error with non-C89 compliant type declaration, one has to pass std=c89 and -pedantic-errors to the compiler.
std=c89
-pedantic-errors
$ cat main.c int main() { int a; a = 1; int b = 2; return 0; } $ gcc -std=c89 main.c # succeeds $ gcc -pedantic -std=c89 -Wall main.c main.c:6:7: warning: ISO C90 forbids mixing declarations and code [-Wdeclaration-after-statement] int b = 2; ^ main.c:6:7: warning: unused variable 'b' [-Wunused-variable] 2 warnings generated. $ gcc -pedantic-errors -std=c89 main.c main.c:6:7: error: ISO C90 forbids mixing declarations and code [-Werror,-Wdeclaration-after-statement] int b = 2;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I've got asked this frequently, that I think is worth pointing out, as it might be useful for writing test cases etc.
To force gcc to throw and error with non-C89 compliant type declaration, one has to pass
std=c89
and-pedantic-errors
to the compiler.The text was updated successfully, but these errors were encountered: