tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: strtoi(3) ERANGE vs ENOTSUP
I think it depends on what you consider valid use cases of strtoi().
> This is the case when the number is out of range, and there's trailing
> garbage -- e.g., s="42z", min=3, max=7.
Is it correct to consider the first non-digit character garbage? I.e., would
you regard it as an abuse of strtoi() to parse strings like "32k", "16M" or
"1.5", "4 2/3?
If the answer is "don't do that" (i.e. a valid use should be entirely
parseble), then I'd expect ENOTSUP. If that's valid use, I'd expect ERANGE.
Home |
Main Index |
Thread Index |
Old Index