http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48091
Eero Tamminen <eerott at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|No warning when given |No warning when given |function arguments mismatch |function arguments mismatch |earlier function definition |earlier function definition |which GCC assumes to be K&R |which GCC assumes to be | |K&R, even with --std=c99 | |-pedantic --- Comment #4 from Eero Tamminen <eerott at gmail dot com> 2011-06-23 19:28:45 UTC --- (In reply to comment #0) > Program: > ---------- > int test(a, b) > int a; > int b; > { > return a+b; > } > int main(void) > { > return test("foo"); > } > ---------- (In reply to comment #1) > That's how K&R works. The function definition isn't a prototype. Right, including an ANSI-C prototype either for: int test(int a, int b); or for: int test(const char *); Would cause there to be a warning. I would never have though somebody to mix K&R & ANSI-C like that, but I just noticed that having K&R function implementations in *.c files with ANSI-C prototypes in headers seems to be e.g. how Glibc does things... It still doesn't help with mistakes like "function() { ... }" for people who have experience with other compilers than GCC. GCC is only compiler with this dangerous defaulting to K&R interpretation.