Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    The function call std::isdigit(c) can be dangerous, because calling the function std::isdigit with a negative argument value will invoke undefined behavior, unless that value is equal to EOF (which is usually -1). See this Stack Overflow answer to another question for further information. Writing std::isdigit(static_cast<unsigned char>(c)), or using the C++ localization library version of the function, would be safer. Commented Apr 10 at 19:01
  • @AndreasWenzel fixed Commented Apr 10 at 19:31
  • Yes, it looks good now. I will not delete my comment, because it will probably be useful for other readers who are wondering why you are using static_cast. Commented Apr 10 at 19:32