Subject: fgets prototype bug?
To: None <tech-userlevel@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-userlevel
Date: 11/16/1999 15:49:01
Is is a bug that fgets() takes an "int" as the size of the object and
not a size_t? Look at the following when compiled on an alpha:
alpha:/tmp 187> cat foo.c
#include <stdio.h>
int foo()
{
char buf[10];
fgets(buf, sizeof buf, stdin);
return(0);
}
alpha:/tmp 188> cc -c -Wconversion foo.c
foo.c: In function `foo':
foo.c:7: warning: passing arg 2 of `fgets' with different width due to prototype
If I change the "sizeof buf" to "(int)sizeof buf" it obviously gets rid
of the warning, but that doesn't seem right...
Simon.