This is based on the work done to add strtoll and the other strto
functions. The atoi functions also were added to stdc and
entrypoints.txt.
Details
- Reviewers
sivachandra - Commits
- rGbad3168b99aa: [libc] add atoi, atol, and atoll
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
address comments
libc/test/src/stdlib/atol_test.cpp | ||
---|---|---|
42 | I've been avoiding LONG_MAX in the tests, since the size of LONG_MAX changes based on the operating system, specifically Windows uses 32 bit long while linux uses 64 bit long. This is difficult when I'm hardcoding the strings. There aren't any overflow value tests since overflowing is undefined behavior for atoi. I can add them, but it means we're testing things that aren't in the specification. | |
48 | I've changed the name of the tests, 010 isn't an invalid number, but it is interpreted as an octal number if the base is set to 0. |
No LONG_MAX tests?
Also, test for overflow values in all tests? We don't need to check the errno value but may be check that the return value is *_MAX/*_MIN?