On 3/15/18 4:11 PM, Martijn Dekker wrote:
> Op 14-03-18 om 16:49 schreef Martijn Dekker:
> [...]
>>      {
>>        digits++;
>>        result = (result * 8) + (*string++ - '0');
>> -      if (result > 0777)
>> +      if (result > 07777)
>>      return -1;
>>      }
>>
>> By the way, why does that function repeatedly check the bounds for every
>> digit?
> 
> It just occurred to me that, given a huge number argument, this
> disallows the value to wrap around and return within the bounds.

The current code fails early.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to