casts to (void)
John Bruner
jdb at mordor.UUCP
Thu Aug 8 13:50:55 AEST 1985
> > That's a mediocre solution, it shouldn't be necessary lint should know the
> > set of standard functions which results needn't be used. It's not accept-
> > able to either put (void) in front of printf(), scanf(), ...etc. or make
> > defines like "#define Printf (void) printf".
>
> And programs that do this don't recover from write errors, like when a
> filesystem runs out of space. That's what lint *correctly* complains about.
For instance, the "passwd" program, which, when copying "passwd"
to "ptmp", will blissfully truncate the password file if the root
filesystem is out of space. This problem has been around since (at
least) V6 and STILL isn't fixed in either 4.2BSD or System V. (The
4.2BSD "passwd" program doesn't bother to cast fprintf(), which the
manual page doesn't document as returning a value anyway. In System V,
"passwd" calls putpwent(), which does check for an error and returns
an error indication. Unfortunately, "passwd" doesn't bother to check
(or cast to (void)) the return value from putpwent().)
--
John Bruner (S-1 Project, Lawrence Livermore National Laboratory)
MILNET: jdb at mordor [jdb at s1-c.ARPA] (415) 422-0758
UUCP: ...!ucbvax!dual!mordor!jdb ...!seismo!mordor!jdb
--
John Bruner (S-1 Project, Lawrence Livermore National Laboratory)
MILNET: jdb at mordor [jdb at s1-c.ARPA] (415) 422-0758
UUCP: ...!ucbvax!dual!mordor!jdb ...!seismo!mordor!jdb
More information about the Comp.unix.wizards
mailing list