rust-embedded-community / tinyrlibc

Tiny C library written in Rust
50 stars 13 forks source link

Set ERRNO in strtol #16

Open gmmyung opened 8 months ago

gmmyung commented 8 months ago
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.

thejpster commented 8 months ago

Seems like a good idea!