Implicition declarations of functions and bugs
Hi,
In buildd logs, I could find several
test.c:3: warning: implicit declaration of function 'f'
warnings
This can be very problematic on 64bits architectures such as AMD64:
test.c:
#include <stdio.h>
int main(void) {
printf("%p\n",f(-1));
return 0;
}
test2.c:
#include <stdio.h>
void *f(long a) {
char c;
printf("%ld %p\n",a,&c);
return &c;
}
result:
4294967295 0x7ffffffc725f
0xfffc725f
instead of
-1 0x7ffffffc725f
0x7ffffffc725f
, which can of course entail a lot of bugs...
Maybe the debian policy should require
-Werror-implicit-function-declaration in CFLAGS so as to avoid such
issue?
Regards,
Samuel
Reply to: