3 ms·
400 is not an 8-bit integer! This function appears to be for parsing integers you know in advance will fit into 8 bits, rather than arbitrary input.
by tom_ 3y ago
400 is not an 8-bit integer! This function appears to be for parsing integers you know in advance will fit into 8 bits, rather than arbitrary input.
- jstanley 3y ago> The function returns a Boolean value indicating whether the input string can be parsed into an unsigned 8-bit integer or not. It returns 1 even though 400 is too large.
- tom_ 3y agoBut the parsed value was 144. It's less than 256! It fits! Indeed, all 3 conditions for returning true were satisfied. Just goes to show the value of accurate documentation: (Always safest to trust the docs. The code could easily be wrong!) - string is 3 chars or less - string contains no non-digit chars - parsed value is less than 256