F
Fumeur
Is the following program standard conform?
(reduced as much as possible so it still shows the problem)
/* begin */
#include <stdio.h>
void xfprintf(FILE *);
void xfprintf(FILE *f) {
fprintf(f, "x\n");
}
int main(void) {
xfprintf(stderr);
return 0;
}
/* end */
It compiles with gcc without warnings and works correctly, but trying
to compile it with a particular other popular compiler, it yields the
following diagnostics:
lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
Error xfprintf.c: 4 redefinition of 'xfprintf'
Error c:\lcc\include\stdio.h: 116 Previous definition of 'xfprintf' here
2 errors, 0 warnings
1 error
make: *** [xfprintf.obj] Error 1
Who is at fault here, my program or the compiler?
(reduced as much as possible so it still shows the problem)
/* begin */
#include <stdio.h>
void xfprintf(FILE *);
void xfprintf(FILE *f) {
fprintf(f, "x\n");
}
int main(void) {
xfprintf(stderr);
return 0;
}
/* end */
It compiles with gcc without warnings and works correctly, but trying
to compile it with a particular other popular compiler, it yields the
following diagnostics:
lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
Error xfprintf.c: 4 redefinition of 'xfprintf'
Error c:\lcc\include\stdio.h: 116 Previous definition of 'xfprintf' here
2 errors, 0 warnings
1 error
make: *** [xfprintf.obj] Error 1
Who is at fault here, my program or the compiler?