cvs commit: src/usr.sbin/portsnap/make_index make_index.c

Greg 'groggy' Lehey grog at FreeBSD.org
Sun Nov 20 16:43:53 GMT 2005


On Sunday, 20 November 2005 at  1:50:42 -0800, Colin Percival wrote:
> Greg 'groggy' Lehey wrote:
>> On Sunday, 20 November 2005 at  0:50:30 +0000, Colin Percival wrote:
>>>  Log:
>>>  An empty file does not have a positive number of lines.
>>
>> Yes it does.  It's 0, not -0.
>
> As a mathematician, I must insist that 0 = -0 and is neither
> positive nor negative. :-)

Hmm, interesting.  I've obviously forgotten too much mathematics.
I've also almost forgotten ones'-complement machines, but I'm pretty
sure that it's correct to say in computers that (+)0 is positive.  On
the ones'-complement machines I knew, -0 was also (usually) negative.

>>>  Make sure that the number of lines read is non-zero before in
>>>  order to avoid dumping core.
>>
>> This is a different (and presumably correct) test.
>
> The correct test is actually to verify that the number of lines
> is positive, but while we cannot assume this (as I originally
> did), we can assume that the number of lines is non-negative
> (and all non-negative non-zero values are positive).

Don't spoil a good story by sticking to facts :-)

Greg
--
See complete headers for address and phone numbers


More information about the cvs-src mailing list