tinyrlibc icon indicating copy to clipboard operation
tinyrlibc copied to clipboard

Set ERRNO in strtol

Open gmmyung opened this issue 1 year ago • 1 comments

On success, the function returns the converted integral number as a long int value.
If no valid conversion could be performed, a zero value is returned (0L).
If the value read is out of the range of representable values by a long int, the function returns LONG_MAX or LONG_MIN (defined in [<climits>](https://cplusplus.com/climits)), and [errno](https://cplusplus.com/errno) is set to ERANGE.

Errno should be set to ERANGE when value is out of range. Reimplementing something similar to errno in Newlib might be possible.

gmmyung avatar Jan 15 '24 09:01 gmmyung

Seems like a good idea!

thejpster avatar Jan 16 '24 20:01 thejpster