I am trying to get Visual Studio to enforce the ANSI C standard when compiling a project, but I can't get it to work. Any tips? I have read all the tutorials, I enabled the /Za option, and named my file as .c (not .cpp). However, the following program still builds successfully:
#include <stdio.h>
void main(void)
{
for (int i = 0; i < 10; i++)
{
}
int f = 0;
}
But it shouldn't. It would have to be like this to respect the ANSI C standard:
#include <stdio.h>
void main(void)
{
int i;
int f = 0;
for (i = 0; i < 10; i++)
{
}
}
I would like the equivalent of the GCC options "-ansi" and "-Wpedantic". Is this even possible in VS?