2 ms·
With a small change to the weird-0 and weird-1 programs: $ gcc -O2 -Wall -W weird-0.c weird-0.c: In function ‘main’: weird-0.c:15:7: warning: unused vari
by kazinator 5y ago
With a small change to the weird-0 and weird-1 programs:
$ gcc -O2 -Wall -W weird-0.c
weird-0.c: In function ‘main’:
weird-0.c:15:7: warning: unused variable ‘x’ [-Wunused-variable]
foo(x);
^
$ gcc -O2 -Wall -W weird-1.c
weird-1.c: In function ‘main’:
weird-1.c:16:3: error: too few arguments to function ‘foo’
foo(x);
^~~
weird-1.c:3:6: note: declared here
void foo(int x, int y)
^~~
The change is in the foo function:
void foo(int x, int y)
{
printf("foo(%d, %d)\n", x, y);
}
The call is now erroneous, and with the increased compiler optimization level and diagnostics, the declaration case diagnoses x being unuse