SOLUTION (Re: Style question: comparison between signed and unsigned?)

Morten Welinder (
Fri, 26 Sep 1997 04:04:24 +0200

A modest proposal. If the code in question is

int i = read(socket, buffer, sizeof(buffer));
/* check for errors */
if (i == -1)
return i;
/* check that we got a valid packet */
if (i < sizeof(struct pkthdr))

then why don't we simply turn that "<" into "!="? I have the feeling
that a lot of the sizeof-based problems/non-problems (depending on
your point of view) will then disappear.

(A function like read isn't supposed to return a count larger than
the buffer size. If it does, we are in deep s. anyway.)