Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-tidy] Check request: modernize-use-stoi-instead-atoi #121174

Open
denzor200 opened this issue Dec 27, 2024 · 1 comment
Open

[clang-tidy] Check request: modernize-use-stoi-instead-atoi #121174

denzor200 opened this issue Dec 27, 2024 · 1 comment
Labels
check-request Request for a new check in clang-tidy clang-tidy

Comments

@denzor200
Copy link

std::string str = "42";
int a = std::atoi(str.c_str()); // INCORRECT
int b = std::stoi(str); //  OK

Since std::atoi is ancient and might produce bugs in overflow cases.

@EugeneZelenko EugeneZelenko added the check-request Request for a new check in clang-tidy label Dec 27, 2024
@firewave
Copy link

This is not a drop-in replacement as they behave very differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
check-request Request for a new check in clang-tidy clang-tidy
Projects
None yet
Development

No branches or pull requests

3 participants